Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.7.4
-
Fix Version/s: 1.7.5, 1.8-beta-2
-
Component/s: None
-
Labels:None
-
Environment:Mac OSX 10.6.3, JVM 1.6.0_20, Groovy 1.7.4
-
Number of attachments :
Description
Attempt to add 'private static' field to a class that has been
annotated as @Immutable causes an error.
Groovy Shell (1.7.4, JVM: 1.6.0_20)
Type 'help' or '\h' for help.
------------------------------------------------------------------------------------------------------------------
groovy:000> @Immutable class AClass
===> true
groovy:000> @Immutable class BClass
ERROR org.codehaus.groovy.control.MultipleCompilationErrorsException:
startup failed:
groovysh_evaluate: -1: cannot modify static final field 'FOO' outside
of static initialization block.
@ line -1, column -1.
groovysh_evaluate: -1: cannot modify static final field 'FOO' outside
of static initialization block.
@ line -1, column -1.
2 errors
...
In Groovy 1.7.3 it does not cause an error.
Groovy Shell (1.7.3, JVM: 1.6.0_20)
Type 'help' or '\h' for help.
------------------------------------------------------------------------------------------------------------------
groovy:000> @Immutable class AClass
===> true
groovy:000> @Immutable class BClass
===> true
groovy:000>
...