RFR: 8302344: Compiler Implementation for Unnamed patterns and variables (Preview) [v12]
Joe Darcy
darcy at openjdk.org
Thu May 4 21:43:22 UTC 2023
On Thu, 4 May 2023 19:58:37 GMT, Joe Darcy <darcy at openjdk.org> wrote:
>> We could indeed if we wanted to store `empty` everywhere. However, after some off-list discussions I updated the CSR (and the code) to include `empty` as the name at the symbol-level (for consistency with javax model) and `_` at the Tree API-level for its version of a name. This is the rationale behind what you see in Attr (for patterns) and member enter for all other cases. @jddarcy what do you think?
>
>>
>
> In terms of pretty printing, src/jdk.compiler/share/classes/com/sun/tools/javac/processing/PrintingProcessor.java may need to be updated too.
>
For the user-facing javax.lang.model languages, I think the current convention of "empty name means unnamed" is reasonable and is consistent with how other unnamed items are handled in that API.
I assumed for the lower-level tree API "_" would be a more appropriate choice, but I'm open to discussions alternative conventions there.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13528#discussion_r1185544462
More information about the compiler-dev
mailing list