Summary
Extend the switch statement so that it can be used as either a statement or an expression, and so that both forms can use either a traditional case :
label (with fall through) or a simplified case ->
label (no fall through).
Problem
When the switch statement is extended, the Compiler Tree API (in the jdk.compiler module) should be extended as well.
Solution
JLS changes are covered by JDK-8207241. The Compiler Tree API will be enhanced with support for these changes.
The language and API changes, as a group, will constitute a preview feature (JEP 12) in Java SE 12. Accordingly, the new APIs are marked as deprecated for removal.
Specification
The changes to the Compiler Tree API are attached as api.diff.02.zip, and also available for convenience at http://cr.openjdk.java.net/~jlahoda/8192963/api.diff.02/
The API adds 2 new types, 7 new methods into existing types, 1 enum constant, and modifies 2 types and 2 methods.
- csr of
-
JDK-8207405 Compiler Tree API support for Switch Expressions (Preview)
- Resolved
- relates to
-
JDK-8207241 Compiler support for Switch Expressions (Preview)
- Closed