RFR: 8194743: Compiler implementation for Statements before super() [v7]

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Sep 25 16:53:22 UTC 2023


On Fri, 7 Jul 2023 18:32:36 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> Archie Cobbs has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 25 commits:
>> 
>>  - Merge branch 'master' into SuperInit
>>  - Fix mistake in previous merge commit 80ba6be4.
>>  - Merge branch 'master' into SuperInit
>>  - Rename unit test to be consistent with other feature exampless.
>>  - Update unit test after merged-in commit eaa80ad08.
>>  - Add unit tests with local class decl's prior to super().
>>  - Merge branch 'master' into SuperInit
>>  - Use @enablePreview in tests in preference to explicit command line flags.
>>  - Make "statements before super()" support a preview feature.
>>    
>>    Thanks to Jim Laskey for help with preview logic.
>>  - Small refactoring to avoid redundant test.
>>  - ... and 15 more: https://git.openjdk.org/jdk/compare/c0aa6bf4...a5f8cc5e
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java line 3975:
> 
>> 3973:     }
>> 3974: 
>> 3975:     private class SuperThisChecker extends TreeScanner {
> 
> we usually create only one instance of these type of visitors that will be used very often and reuse it whenever necessary

Actually, I disagree a bit with the direction here. Having more mutable state is, I believe, not great. In this case the state has to be discarded after a call to `check`, so IMHO having mutable state lying around is a smell. What do you think @vicente-romero-oracle ?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13656#discussion_r1336156335


More information about the compiler-dev mailing list