Thodoris Sotiropoulos created GROOVY-11273:
----------------------------------------------

             Summary: 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


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)

Reply via email to