RFR: 8300543 Compiler Implementation for Pattern Matching for switch [v2]
Vicente Romero
vromero at openjdk.org
Wed Apr 19 04:23:51 UTC 2023
On Tue, 18 Apr 2023 09:13:01 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 six additional commits since the last revision:
>
> - Fixing infinite loop where a binding pattern is replaced with a binding pattern for the same type.
> - Reflecting review comments.
> - Fixing exhaustiveness for unsealed supertype pattern.
> - No need to enable features after error reported.
> - SwitchBootstraps.typeSwitch should not initialize enum classes.
> - A prototype of avoiding enum initialization.
src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java line 263:
> 261: private static <E extends Enum<E>> void validateEnumLabel(Class<?> enumClassTemplate, Object label) {
> 262: if (label == null) {
> 263: throw new IllegalArgumentException("null label found");
I think that this one is not hit by any test
src/java.base/share/classes/java/lang/runtime/SwitchBootstraps.java line 274:
> 272: //OK
> 273: } else {
> 274: throw new IllegalArgumentException("label with illegal type found: " + labelClass +
I think that this code is not being tested by any test
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13074#discussion_r1170788337
PR Review Comment: https://git.openjdk.org/jdk/pull/13074#discussion_r1170786847
More information about the core-libs-dev
mailing list