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 2021/10/11 01:05:00 UTC

[jira] [Created] (GROOVY-10293) STC fails to catch final field re-assign within constructor or initializer

Eric Milles created GROOVY-10293:
------------------------------------

             Summary: STC fails to catch final field re-assign within constructor or initializer
                 Key: GROOVY-10293
                 URL: https://issues.apache.org/jira/browse/GROOVY-10293
             Project: Groovy
          Issue Type: Improvement
          Components: Static Type Checker
            Reporter: Eric Milles


Follow up from GROOVY-5450.  Consider the following:
{code:groovy}
@groovy.transform.TypeChecked
class C{
  C(Cthat) {
    this.x = that.x
    that.x = this.x // error
    this.x = that.x // error
  }
  final x
}
{code}

No error for assign of other's final field and no error for re-assign of own final field.



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