You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2024/01/11 07:16:00 UTC

[jira] [Assigned] (GROOVY-11273) Fail to identify updates on final variables declared in default methods

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

Paul King reassigned GROOVY-11273:
----------------------------------

    Assignee: Paul King

> Fail to identify updates on final variables declared in default methods
> -----------------------------------------------------------------------
>
>                 Key: GROOVY-11273
>                 URL: https://issues.apache.org/jira/browse/GROOVY-11273
>             Project: Groovy
>          Issue Type: Bug
>          Components: Static Type Checker
>            Reporter: Thodoris Sotiropoulos
>            Assignee: Paul King
>            Priority: Minor
>              Labels: default-methods
>
> I have the following ill-typed program:
> {code}
> interface Test {
>   default void test() {
>     final int x = 1;
>     x = 2;
>   } 
> }
> {code}
> h3. Actual behavior
> The code compiles successfully
> h3. Expected behavior
> Code rejected with:
> {code}
> org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
> test.groovy: 4: The variable [x] is declared final but is reassigned
> . At [4:5]  @ line 4, column 5.
>        x = 2;
>        ^
> 1 error
> {code}
> Tested against master (commit: 3cd76364f772250324f5729ef93ffd76fbdd2b79)



--
This message was sent by Atlassian Jira
(v8.20.10#820010)