JEP 455: JLS change for switch expressions

Yuriy Maslyanko yuriy.maslyanko at oracle.com
Wed Oct 18 21:38:39 UTC 2023


Hi Angelos,

JCK team started working on JEP 455: Primitive types in Patterns, instanceof, and switch (Preview). Just noticed that in the draft spec, https://cr.openjdk.org/~abimpoudis/instanceof/jep443-20231010/specs/instanceof-jls.html, there is a change for the switch statement:

14.11 The switch Statement
The Expression is called the selector expression. The type of the selector expression must be char, byte, short, int, or a reference type, or a compile-time error occurs. (jls-14.11-200)
->
The Expression is called the selector expression. The type of the selector expression can be either a primitive or a reference type.

But the corresponding assertion for switch expressions is not changed:

15.28. switch Expressions
The Expression is called the selector expression. The type of the selector expression must be char, byte, short, int, or a reference type, or a compile-time error occurs. (jls-15.28-200)

Could you please take a look?

Thanks,
Yuriy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/compiler-dev/attachments/20231018/6466e6ab/attachment.htm>


More information about the compiler-dev mailing list