3

I resolved this myself, but the compilation error provided no feedback so I'm dropping the fix here.

The code was something like

def aMethod(String param1, String param2)
{
  Sql gsql = Sql.newInstance(<init code>)
  int hashCode = null

  ... more code
}

I assumed that Groovy was wrapping the int variable in an object, but apparently not fully. When I removed the int hashcode = null, everything ran fine.

May be related to some of the static compilation/optimization stuff that is going into Groovy these days

2
  • Oh, the VerifyError seemed to occur when I instantiated the class... It appears the JDK rejected the generated bytecode from what I could tell. Commented Nov 1, 2013 at 21:12
  • 2
    When you get a VerifyError, it's time to file a bug report in the Groovy issue tracker. Commented Nov 1, 2013 at 21:32

1 Answer 1

3

Firstly thanks to Peter for filing https://issues.apache.org/jira/browse/GROOVY-6419

int x = null is not valid in Groovy anymore since Groovy 1.8. Back then we made quite big change called "primitive optimizations", which allows Groovy to run some programs with a near Java speed, if the program is mostly based on Java primitives. Sadly this required Groovy to handle int really as int when it comes to null. Otherwise we would be unable to use the operations the JVM offers for this and thus loss the speed advantage again.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.