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

Vicente Romero vromero at openjdk.org
Thu May 4 19:33:28 UTC 2023


On Thu, 4 May 2023 17:48:28 GMT, Aggelos Biboudis <abimpoudis at openjdk.org> wrote:

>> This PR implements [JEP 443](https://openjdk.org/jeps/443), the preview feature for Unnamed Patterns and Variables in Java.
>> 
>> Draft Spec: https://cr.openjdk.org/~abimpoudis/unnamed/latest/
>
> Aggelos Biboudis has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Add test

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransPatterns.java line 535:

> 533:                 if (clearedPatterns.size() > 1) {
> 534:                     validCaseLabelList = clearedPatterns.stream().allMatch(cP -> cP.hasTag(Tag.PATTERNCASELABEL));
> 535:                 } else validCaseLabelList = clearedPatterns.size() == 1 && clearedPatterns.head.hasTag(Tag.PATTERNCASELABEL);

style: I would use `{}` for the code in the `else` branch here, same way as it has been done for the `then` branch. Also in the `else` branch isn't the `clearedPatterns.size() == 1` condition always true?

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

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


More information about the compiler-dev mailing list