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

Aggelos Biboudis abimpoudis at openjdk.org
Tue May 2 09:49:42 UTC 2023

On Mon, 1 May 2023 22:28:00 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:

>> src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java line 826:
>>> 824:                 //type test pattern:
>>> 825:                 UnnamedDetails result = identOrFlagUnderscore(mods);
>>> 826:                 JCVariableDecl var = toP(F.at(result.varPos()).VarDef(mods, result.name(), e, null));
>> Do you think we can delegate to `variableDeclarator` here?
> The behavior I observe is that `variableDeclarator` does not behave well when we have a `var` instead of a type in a type pattern. `variableDeclarator` is well suited for variable declarations but not for type patterns. But I can investigate further.

What about reusing `variableDeclaratorRest`? 



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

More information about the compiler-dev mailing list