RFR: 8300543 Compiler Implementation for Pattern Matching for switch [v4]

Vicente Romero vromero at openjdk.org
Fri Apr 21 16:34:00 UTC 2023


On Fri, 21 Apr 2023 10:56:55 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.
>
> Jan Lahoda has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Replacing use of mutable callsite with a mutable state.

src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java line 302:

> 300:                                     MethodHandles.Lookup lookup, Class<?> enumClass,
> 301:                                     ResolvedEnumLabels resolvedLabels) {
> 302:         Objects.checkIndex(startIndex, unresolvedLabels.length + 1);

I think that we should add a comment to the related API stating that IOOBE can be thrown.

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

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


More information about the compiler-dev mailing list