JEP 455: JLS change for switch expressions

Yuriy Maslyanko yuriy.maslyanko at oracle.com
Wed Oct 18 22:53:04 UTC 2023


Thanks Angelos!

From: Angelos Bimpoudis <angelos.bimpoudis at oracle.com>
Sent: Wednesday, October 18, 2023 3:25 PM
To: Yuriy Maslyanko <yuriy.maslyanko at oracle.com>
Cc: compiler-dev at openjdk.org
Subject: Re: JEP 455: JLS change for switch expressions

Correct and good catch!

Spec updated.

Many thanks 🚀
________________________________
From: Yuriy Maslyanko <yuriy.maslyanko at oracle.com<mailto:yuriy.maslyanko at oracle.com>>
Sent: 18 October 2023 23:38
To: Angelos Bimpoudis <angelos.bimpoudis at oracle.com<mailto:angelos.bimpoudis at oracle.com>>
Cc: compiler-dev at openjdk.org<mailto:compiler-dev at openjdk.org> <compiler-dev at openjdk.org<mailto:compiler-dev at openjdk.org>>
Subject: JEP 455: JLS change for switch expressions


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/07b3eda4/attachment.htm>


More information about the compiler-dev mailing list