Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.7.4
-
None
-
None
-
Windows, Groovy Version: 1.7.4 JVM: 1.6.0_21
Description
Static import does not work from Groovy scripts.
Example:
foo/Constants.groovy:
package foo class Constants { static final PI = 3.14 }
foo/Test.groovy
package foo import static foo.Constants.PI class Test { static main(args) { println("pi=" + PI) } }
When you try to run this (without compling with groovyc first), you get:
groovy -cp . foo\Test.groovy Caught: groovy.lang.MissingPropertyException: No such property: PI for class: foo.Test at foo.Test.main(Test.groovy:6)
If you first run "groovyc foo\Constants.groovy" the above command succeeds.