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

Aggelos Biboudis abimpoudis at openjdk.org
Wed May 3 15:41:19 UTC 2023


On Fri, 28 Apr 2023 09:16:29 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/comp/MemberEnter.java line 295:
> 
>> 293:                 : tree.vartype.type;
>> 294:         Name name;
>> 295:         if (Feature.UNNAMED_VARIABLES.allowedInSource(source) && (tree.mods.flags & UNNAMED) != 0) {
> 
> Not 100% sure what this code does. E.g. shouldn't we just set the name of the variable as the name stored in the tree? It seems more economical if we could just set in the parser the name as empty (if preview features are enabled etc.) - and then all these special cases can disappear. After all, you still have the flag (and even then, do we need a flag? Can't we just see whether the name is empty to see that it's unnamed?)

This is still needed because we want to have a different name for the Tree API (_) and the symbol (empty).

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

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


More information about the kulla-dev mailing list