Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0-RC-1
-
None
-
None
Description
Error when trying to call the static method forName() of the class java.lang.Class. The script:
static def blah() {
['Integer'].collect
}
when compiled with groovyc gives:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, bug15.groovy: 2: Class is declared in a dynamic context, but you tried to access it from a static context.
@ line 2, column 26.
['Integer'].collect { Class.forName(it).newInstance() }
^
If I put "java.lang." in front of Class, it complains that java is declared in a dynamic context.