[JEP 420] Spec Change for switch exhaustive with sealed
Manoj Palat
manoj.palat at in.ibm.com
Wed Feb 16 23:08:35 UTC 2022
Hi Gavin, all,
For the issue “Switch coverage with multiple branches” raised in https://mail.openjdk.java.net/pipermail/amber-spec-experts/2021-July/003049.html by Dan [yeah – I know it’s a little late to ask this, but still :( ], I couldn’t figure out a spec change in JEP 420 - from the relevant part, it says the following:
“T supports a sealed class or interface named C, and the switch block is exhaustive for all the permitted direct subclasses and subinterfaces of C that are applicable at type T.”
And it still says “exhaustive for all the permitted…” However, I see that JDK18 accepts the code mentioned in the mail [via JDK-8274363 /b18].
Is there a spec change expected in the next version where this would be made explicit or is this “exhaustiveness wrt permitted classes” assumed to be an implementation detail?
Regards,
Manoj
More information about the amber-spec-observers
mailing list