Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: 1.5.6
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:OS X, Java 1.5
-
Testcase included:yes
-
Number of attachments :
Description
The following test case fails:
#!/usr/bin/env groovy
Object.metaClass.'static'.helloWorld = {
println "Hello world!"
}
class MyClass {
static {
helloWorld()
}
}
def myClass = new MyClass ()
The above code fails with the following exception:
Caught: java.lang.ExceptionInInitializerError at
DefStaticProperty.class$(DefStaticProperty.groovy) at
DefStaticProperty.run(DefStaticProperty.groovy:13) at
DefStaticProperty.main(DefStaticProperty.groovy)
As a workaround, this works: