RFR: 8015831: Add lint check for calling overridable methods from a constructor [v8]
Archie L. Cobbs
duke at openjdk.org
Fri Jan 13 15:16:59 UTC 2023
On Fri, 13 Jan 2023 12:42:24 GMT, Vicente Romero <vromero at openjdk.org> wrote:
>> Archie L. Cobbs has updated the pull request incrementally with 16 additional commits since the last revision:
>>
>> - Fix bug where all but the last yeild statement were being ignored.
>> - Add method RefSet.mapInto() and use to refactor/clean up.
>> - Fix possible assertion failure when handling if statements.
>> - Use Symbol methods isSubClass() and isEnclosedBy() instead of homebrew stuff.
>>
>> Suggested-by: mcimadamore
>> - Add comment regarding limitations of expresison type filtering.
>> - Add a few more DISABLED_WARNINGS to unbreak build.
>> - Clean up handling of switch expressions a bit.
>> - Remove unused method variant of analyzeTree().
>> - Avoid all caps in comments.
>> - Clarify confusing comment.
>> - ... and 6 more: https://git.openjdk.org/jdk/compare/6e96a7d7...edf3c3f5
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ThisEscapeAnalyzer.java line 516:
>
>> 514: Name name = TreeInfo.name(invoke.meth);
>> 515: if (name == names._super) {
>> 516: scanInitializers();
>
> it seems like the code scan initializers every time it finds a super() invocation, I guess that this scanning could be done once per class
Yes... I did it that way is so that it doesn't require any adaptation if/when JDK-8194743 ever gets implemented. And it keeps the code a little simpler in exchange for a little redundancy.
I'm happy to fix this if you think it is necessary though.
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ThisEscapeAnalyzer.java line 533:
>
>> 531: if (sym != null &&
>> 532: sym.owner.kind == TYP &&
>> 533: ((ClassSymbol)sym.owner).fullname == names.java_lang_Object &&
>
> nit: in general we use another idiom for this in the compiler:
>
> sym.owner.type.tsym == syms.objectType.tsym
>
> where `syms` is an instance of: `com.sun.tools.javac.code.Symtab`
Thanks - will fix.
-------------
PR: https://git.openjdk.org/jdk/pull/11874
More information about the build-dev
mailing list