Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: 1.6
-
Fix Version/s: 1.6.1, 1.7-beta-1
-
Component/s: None
-
Labels:None
-
Environment:jdk1.6_12, Vista
Groovy 1.6 console and Grails 1.1
-
Testcase included:yes
-
Number of attachments :
Description
// generates error class Foo { long id // or float or double boolean bar() { return (id ? true : false) } } Foo foo = new Foo()
Running the above will result in the following exception:
java.lang.VerifyError: (class: Foo, method: bar signature: ()Z) Expecting to find integer on stack
Declaring id as a float or double will also generate this error; however, if Foo.id is any other type (primitive or otherwise) then the script runs properly. Similarly, explicitly casting Foo.id inside Foo.bar() does not generate this error:
// no VerifyError class Foo { long id boolean bar() { return (long)id ? true : false } } // no VerifyError class Foo { int id // or boolean or char or Long, etc. boolean bar() { return id ? true : false } }
A very small addition. The method does not have to be boolean returning. Even the following fails with the same error:
class Foo { long id def bar() { return (id ? "a" : "b") } } println Foo.class