Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.7.4
-
None
-
None
-
Mac OSX 10.6.3, JVM 1.6.0_20, Groovy 1.7.4
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>
...
Attachments
Issue Links
- relates to
-
GROOVY-10925 @TupleConstructor namedVariant breaks on setting private final fields in constructor
- Open