RFR: 8015831: Add lint check for calling overridable methods from a constructor [v10]
Archie L. Cobbs
duke at openjdk.org
Tue Jan 17 17:19:40 UTC 2023
On Mon, 16 Jan 2023 13:30:11 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:
>> Archie L. Cobbs has updated the pull request incrementally with two additional commits since the last revision:
>>
>> - Fix bug where field initializer warnings could be incorrectly suppressed.
>> - Consolidate all the unit tests that generate warnings into one.
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ThisEscapeAnalyzer.java line 293:
>
>> 291: return !currentClass.sym.isFinal() &&
>> 292: !(currentClass.sym.isSealed() && currentClass.permitting.isEmpty()) &&
>> 293: !(currentClass.sym.owner.kind == MTH) &&
>
> Maybe `isDirectlyOrIndirectlyLocal`?
> Suggestion:
>
> !currentClass.sym.isDirectlyOrIndirectlyLocal()
>
>
> (Or enhance the `privateOuter` flag to also handle local classes? something like `tree.sym.kind.matches(Kinds.KindSelector.VAL_MTH)`.)
Yes, that's better - thanks, will fix.
-------------
PR: https://git.openjdk.org/jdk/pull/11874
More information about the compiler-dev
mailing list