title: groovy error: Primitive type literal: byte cannot be used as a method name
body: <p>I am used to python-style REPL testing of code on a shell and I am learning Java. I recently learnt that <em>almost</em> all Java code can be executed in a REPL manner via groovy. So far the groovy console has helped me quickly test my Java code snippets.</p>
  
  <p>I am trying to run the following Java code in the groovy console (which I happened to get from <a href="https://stackoverflow.com/questions/4846484/md5-or-other-hashing-in-android">another Stackoverflow question</a>):</p>
  
  <pre><code>String md5(String s)
  {
          MessageDigest digest = java.security.MessageDigest.getInstance("MD5");
          digest.update(s.getBytes());
          byte messageDigest[] = digest.digest();
  
          // Create Hex String
          StringBuffer hexString = new StringBuffer();
          for (int i=0; i&lt;messageDigest.length; i++)
          hexString.append(Integer.toHexString(0xFF &amp; messageDigest[i]));
  
          return hexString.toString();
  }
  
  String md5hash = md5("a test message");
  </code></pre>
  
  <p>When I try to execute this, I am getting the following error message: </p>
  
  <p><strong>Primitive type literal: byte cannot be used as a method name at line: 5 column: 13. File: ConsoleScript0 at line: 6, column: 13</strong></p>
  
  <p>I searched for the error message here on SO and elsewhere, but I couldn't get any clues. It seems to be valid Java code, so why does groovy think that I'm trying to use "byte" as a method name?</p>
  
  <p>I'm using Groovy Version: 1.8.4 JVM: 1.6.0_26</p>