Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
3.0.5, 2.5.13
-
None
Description
The JLS (recent versions at least) states:
It is a compile-time error if a final variable is also declared volatile.
Compiling this class:
public class Foo { final volatile String foo = "bar"; }
in Java gives the following compilation error:
error: illegal combination of modifiers: final and volatile
Groovy currently passes compilation but then gives the following error at runtime when trying to create an instance of such a class:
java.lang.ClassFormatError: Illegal field modifiers in class Foo: 0x52
Groovy should also have a compilation error for this case.