You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Eric Milles (Jira)" <ji...@apache.org> on 2022/05/22 16:00:00 UTC

[jira] [Updated] (GROOVY-9726) Compile error needed for illegal field modifier combination

     [ https://issues.apache.org/jira/browse/GROOVY-9726?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Milles updated GROOVY-9726:
--------------------------------
    Labels: ClassFormatError  (was: )

> 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: 3.0.5, 2.5.13
>            Reporter: Paul King
>            Assignee: Paul King
>            Priority: Major
>              Labels: ClassFormatError
>             Fix For: 4.0.0-alpha-1, 3.0.6, 2.5.16
>
>
> 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.20.7#820007)