title: Different results when setting/getting System properties with GStrings in Groovy
body: <p>I'm perplexed by Groovy's behavior here.  I've run through the debugger some to try to determine where in the dynamic mixins these code paths may be getting crossed but wondered if anyone could set me straight here.</p>
  
  <p>Basically, in setting a system property with a GString for a value, depending on how I set the property, the property is not always readable back via certain methods.</p>
  
  <p>I have seen <a href="https://stackoverflow.com/questions/39141245/why-map-does-not-work-for-gstring-in-groovy">Why Map does not work for GString in Groovy?</a> and <a href="https://stackoverflow.com/questions/9705492/why-groovy-does-not-see-some-values-in-dictionary">Why groovy does not see some values in dictionary?</a> but my question specifically applies to map values so not sure those apply or not?</p>
  
  <p>Snippet :</p>
  
  <pre><code>def tdollar='dollar'
  
  System.setProperty('key1', 'value1')
  System.setProperty('key2', "value2$tdollar")
  // Replace the below with any property setting method other than
  // the above with the same results
  System.properties['key4']='value4'
  System.properties['key5']="value5$tdollar"
  
  println System.hasProperty('key1')
  println System.hasProperty('key2')
  println System.hasProperty('key4')
  println System.hasProperty('key5')
  println
  
  println System.getProperty('key1')
  println System.getProperty('key2')
  println System.getProperty('key4')
  println System.getProperty('key5')
  println
  
  println System.properties.keySet()
  println
  
  println System.properties['key1']
  println System.properties['key2']
  println System.properties['key4']
  println System.properties['key5']
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>null
  null
  null
  null
  
  value1
  value2dollar
  value4
  null
  
  [java.runtime.name, sun.boot.library.path, java.vm.version, gopherProxySet, java.vm.vendor, java.vendor.url, path.separator, java.vm.name, file.encoding.pkg, user.country, sun.java.launcher, sun.os.patch.level, program.name, key5, key4, java.vm.specification.name, user.dir, key2, java.runtime.version, key1, java.awt.graphicsenv, java.endorsed.dirs, os.arch, java.io.tmpdir, line.separator, java.vm.specification.vendor, os.name, tools.jar, sun.jnu.encoding, script.name, java.library.path, java.specification.name, java.class.version, sun.management.compiler, os.version, user.home, user.timezone, java.awt.printerjob, file.encoding, java.specification.version, java.class.path, user.name, java.vm.specification.version, sun.java.command, java.home, sun.arch.data.model, user.language, java.specification.vendor, awt.toolkit, java.vm.info, java.version, java.ext.dirs, sun.boot.class.path, java.vendor, file.separator, java.vendor.url.bug, sun.io.unicode.encoding, sun.cpu.endian, groovy.starter.conf, groovy.home, sun.cpu.isalist]
  
  value1
  value2dollar
  value4
  value5dollar
  </code></pre>
  
  <p>Why, if I don't use <code>System.setProperty(key, value)</code> syntax, is the property not readable via <code>System.getProperty(key)</code>, but is still readable via any other method?</p>
  
  <p>Given this behavior, is there a best practice documented regarding System properties in Groovy.</p>
  
  <p>Writing this, I wonder if this is just a general map question.  Will test.</p>