Paul King created GROOVY-9726:
---------------------------------

             Summary: Compile error needed for illegal field modifier 
combination
                 Key: GROOVY-9726
                 URL: https://issues.apache.org/jira/browse/GROOVY-9726
             Project: Groovy
          Issue Type: Improvement
    Affects Versions: 2.5.13, 3.0.5
            Reporter: Paul King


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



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to