RFR: 8015831: Add lint check for calling overridable methods from a constructor [v7]
Archie L. Cobbs
duke at openjdk.org
Thu Jan 12 18:09:27 UTC 2023
On Thu, 12 Jan 2023 12:26:27 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> Do we really need a set for this?
There are surely other ways to model things. But I got myself really confused trying to build more complicated models.
What I ended up with is this simple model that works:
* There is a set of `Ref` subclasses that model the various types of 'this' references possible: `OuterRef`, `ExprRef`, etc.
* There is a singleton `this.refs`, which just is a `Set<Ref>`, containing the 'this' references that are alive at the current moment
* As we "execute" code, all we need to do is update the `this.refs` based on what the current bit of code does
E.g....
When a variable is assigned a value that has a reference, we add a `VarRef` for that variable.
When we leave a scope, we remove any `Ref`'s that are no longer in scope.
Before executing a method, we add `Ref`'s for the method receiver and parameter.
When we return from a non-void method, we convert any `ReturnRef` into a `ExprRef`.
Etc.
THAT I can understand.
I don't see converting the above into a bitmap or whatever as worth the additional complexity. We're not programming in perl here.
-------------
PR: https://git.openjdk.org/jdk/pull/11874
More information about the build-dev
mailing list