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

Vicente Romero vromero at openjdk.org
Mon Sep 25 17:23:15 UTC 2023


On Mon, 25 Sep 2023 16:50:00 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> 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 ?

yes @mcimadamore I see your point. And after my comments I think we discussed a similar issue in another bug and we went for the non-mutable state. After revisiting the code I agree that in this case it could be better to avoid having mutable state.

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

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


More information about the compiler-dev mailing list