Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.7.4
-
Fix Version/s: 1.7.6, 1.8-beta-3
-
Component/s: None
-
Labels:None
-
Environment:Windows, Groovy Version: 1.7.4 JVM: 1.6.0_21
-
Number of attachments :
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.
Same problem with Groovy 1.7.5