Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.0-JSR-5
-
None
-
None
Description
When upgrading from earlier groovy builds to the new visibility/@Property handling, or when not understanding these new rules
properly, code can fail unexpectedly - although it seems to be related to inherited access only. testInheritedStaticFinal fails.
import groovy.util.GroovyTestCase /* Test script to examine static field/property issues in JSR 05 */ class TestVisibility extends GroovyTestCase { void testInheritedStaticFinal() { new B().constantAccess() } void testStaticFinal() { def x = A.SOMECONSTANT } void testInheritedPublicStaticFinal() { new D().constantAccess() } void testPublicStaticFinal() { def x = C.SOMECONSTANT } } class A { static final SOMECONSTANT = 0 } class B extends A { void constantAccess() { println SOMECONSTANT } } class C { public static final SOMECONSTANT = 0 } class D extends C { void constantAccess() { println SOMECONSTANT } }