Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.0-JSR-3
-
None
-
None
-
Java 1.5.0_03 on Windows XP
Description
When accessing a private static field, you get a "NoSuchFieldException" instead of an "IllegalPropertyAccessException:"
groovy> class A
{ static x }groovy> A.x = new Integer(10)
groovy> go
Caught: java.lang.NoSuchFieldException: x
at CommandLine.run(CommandLine.groovy:2)
With non-static fields, you get a more informative message:
groovy> class A
{ def x }groovy> a = new A()
groovy> a.x = new Integer(10)
groovy> go
Caught: groovy.lang.IllegalPropertyAccessException: Can not access the private field x in class A
at gjdk.groovy.lang.MetaClass_GroovyReflector.invoke(Unknown Source)
at A.setProperty(CommandLine.groovy)
at CommandLine.run(CommandLine.groovy:1)