Christopher Smith created GROOVY-11078:
------------------------------------------

             Summary: Compiler does not validate final assignment in 
constructors
                 Key: GROOVY-11078
                 URL: https://issues.apache.org/jira/browse/GROOVY-11078
             Project: Groovy
          Issue Type: Bug
          Components: Compiler
    Affects Versions: 4.0.12
            Reporter: Christopher Smith


The Groovy compiler does not seem to make any attempt to verify that final 
fields are assigned during object construction, making possible very simple 
bugs (I added a property but forgot the "this" assignment) that the Java 
compiler flags. I'm aware that the richness of Groovy expressiveness may make 
this difficult, but it's frustrating not to have that safeguard.

{code}
class Bug {
    final Object o // and add an explicit constructor if you like
}
{code}



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

Reply via email to