RFR: 8300543 Compiler Implementation for Pattern Matching for switch

Vicente Romero vromero at openjdk.org
Fri Apr 14 18:33:31 UTC 2023


On Fri, 17 Mar 2023 12:15:58 GMT, Jan Lahoda <jlahoda at openjdk.org> wrote:

> This is the first draft of a patch for JEP 440 and JEP 441. Changes included:
> 
>  - the pattern matching for switch and record patterns features are made final, together with updates to tests.
>  - parenthesized patterns are removed.
>  - qualified enum constants are supported for case labels.
> 
> This change herein also includes removal record patterns in for each loop, which may be split into a separate PR in the future.

src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java line 4092:

> 4090:                     log.error(DiagnosticFlag.SOURCE_LEVEL, tree.pos(),
> 4091:                               Feature.UNCONDITIONAL_PATTERN_IN_INSTANCEOF.error(this.sourceName));
> 4092:                     allowUnconditionalPatternsInstanceOf = true;

sorry not sure why we are doing this. Either the feature should be allowed or not right?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/13074#discussion_r1167168581


More information about the core-libs-dev mailing list