RFR: 8302344: Compiler Implementation for Unnamed patterns and variables (Preview) [v4]

Aggelos Biboudis abimpoudis at openjdk.org
Mon May 1 22:29:30 UTC 2023


On Fri, 28 Apr 2023 08:56:38 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Update test files with JDK 8307007 bug id
>
> src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java line 839:
> 
>> 837:     }
>> 838: 
>> 839:     private UnnamedDetails identOrFlagUnderscore(JCModifiers mods) {
> 
> I'm not 100% sure this is required - the main use seems to be in `variableDeclarator` - but in that method you already have a token to look at, and a set of modifiers that you can augment - so why not just doing everything in that method (instead of preprocessing it?)

Good point. That was an artifact of code evolution. Everything is integrated in `variableDeclarator` now.

> src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java line 3555:
> 
>> 3553:      */
>> 3554:     JCVariableDecl variableDeclarator(JCModifiers mods, JCExpression type, boolean reqInit, Comment dc, boolean localDecl) {
>> 3555:         UnnamedDetails result = identOrFlagUnderscore(mods);
> 
> Why do we need to get the "unnamed details" here, instead of letting the code flow to `variableDeclaratorRest` and do it there?

Indeed. I removed it.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1181937000
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1181937191


More information about the kulla-dev mailing list