title: Groovy different results on using equals() and == on a GStringImpl
body: <p>According to the <a href="http://groovy-lang.org/style-guide.html#_equals_and_code_code" rel="nofollow noreferrer">Groovy docs</a>, the <code>==</code> is just a &quot;clever&quot; <code>equals()</code> as it also takes care of avoiding <code>NullPointerException</code>:</p>
  <blockquote>
  <p>Java’s <code>==</code> is actually Groovy’s <code>is()</code> method, and Groovy’s <code>==</code> is a clever <code>equals()</code>!</p>
  <p>[...]</p>
  <p>But to do the usual <code>equals()</code> comparison, you should prefer Groovy’s <code>==</code>, as it also takes care of avoiding <code>NullPointerException</code>, independently of whether the left or right is <code>null</code> or not.</p>
  </blockquote>
  <p>So, the <code>==</code> and <code>equals()</code> should return the same value if the objects are not null. However, I'm getting unexpected results on executing the following script:</p>
  <pre class="lang-groovy prettyprint-override"><code>println &quot;${'test'}&quot; == 'test'
  println &quot;${'test'}&quot;.equals('test')
  </code></pre>
  <p>The output that I'm getting is:</p>
  <pre class="lang-none prettyprint-override"><code>true
  false
  </code></pre>
  <p>Is this a known bug related to <code>GStringImpl</code> or something that I'm missing?</p>