RFR: 8315735: VerifyError when switch statement used with synchronized block [v2]
Jan Lahoda
jlahoda at openjdk.org
Wed Sep 6 20:35:37 UTC 2023
On Wed, 6 Sep 2023 19:47:22 GMT, Rémi Forax <forax at openjdk.org> wrote:
>> src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java line 1281:
>>
>>> 1279: //where:
>>> 1280: private boolean hasTry(JCSwitchExpression tree) {
>>> 1281: var scan = new TreeScanner() {
>>
>> I think `scanner` might be a better name for this:
>> Suggestion:
>>
>> var scanner = new TreeScanner() {
>
> I agree, the first guideline of the excellent guide written by Stuart Marks about the usage of 'var' is "Choose variable names that provide useful information [1].
>
> [1] https://openjdk.org/projects/amber/guides/lvti-style-guide#G1
To be honest, I don't see a big difference between "scan", "scanner" and "treeScanner" - these describe the type of the variable, but not its purpose. So, I've used `hasTryScanner`, which conveys the purpose as well. Not a big reason to use less readable tricks with anonymous and var either - javac normally uses local classes to perform tasks like this.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15584#discussion_r1317803699
More information about the compiler-dev
mailing list