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

Archie L. Cobbs duke at openjdk.org
Tue Jan 17 18:36:12 UTC 2023


On Tue, 17 Jan 2023 18:09:51 GMT, Vicente Romero <vromero 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 215:
> 
>> 213:         // Classify all ctors and methods as analyzable and/or invokable.
>> 214:         // Track which constructors and fields have warnings suppressed.
>> 215:         new TreeScanner() {
> 
> I wonder if it would be better to have this visitor be defined externally, the benefit of this would be that it can be created only once instead of every time we enter this method, also I think it would improve the readability of this method. But I let this to your consideration

This method is only supposed to ever be entered once...  but you made me realize that there should probably be an assertion check for that assumption.

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

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



More information about the build-dev mailing list