RFR: 8015831: Add lint check for calling overridable methods from a constructor [v11]

Archie L. Cobbs duke at openjdk.org
Tue Jan 17 14:49:39 UTC 2023


On Tue, 17 Jan 2023 11:23:07 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Archie L. Cobbs has updated the pull request incrementally with three additional commits since the last revision:
>> 
>>  - Remove unused type variable on method visitScoped().
>>  - Remove expression type filtering; it doesn't seem to be needed.
>>  - Clean up unused import.
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ThisEscapeAnalyzer.java line 417:
> 
>> 415:         boolean referenceExpressionNode;
>> 416:         switch (tree.getTag()) {
>> 417:         case SWITCH_EXPRESSION:
> 
> Missing indent?

Thanks - will fix (habits are hard to break).

> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/ThisEscapeAnalyzer.java line 444:
> 
>> 442: 
>> 443:         // Sanity check
>> 444:         Assert.check(checkInvariants(true, referenceExpressionNode));
> 
> Just a note that now the only reason we set up that big switch is to capture `referenceExpressionNode` which is only used in `checkInvariants` (which looks more of a debugging function). I'll leave it up to you whether to keep it as is.

Correct... the debug check is valuable and low cost so I think it's worth keeping for now.

-------------

PR: https://git.openjdk.org/jdk/pull/11874


More information about the compiler-dev mailing list