Java 20, the next planned version of standard Java, has its first feature proposal: Pattern matching for switch statements and expressions will be previewed for the fourth time in the forthcoming Java SE (Standard Edition) release.
While OpenJDK’s JDK (Java Development Kit) 20 web page still lists no features for the planned release, the Java Enhancement Proposal (JEP) index cites a fourth preview of pattern matching for switch as targeted for JDK 20. JDK 20 is due next March.
Pattern matching for switch statements and expressions is viewed as a mechanism to enable concise and safe expression of complex data-oriented queries. Previously previewed in JDK 17, JDK 18, and JDK 19, the fourth preview would enable a continued co-evolution with Record Patterns, also included as a preview in JDK 19, allowing for continued refinements based on experience and feedback.
The main changes in pattern matching for switch since the third preview include simplified grammar for switch labels and support for inference of type arguments for generic patterns and record patterns in switch statements and expressions.
Record Patterns has been designated for a second preview but no specific targeted release of Java SE has been set for it yet. In addition to pattern matching and Record Patterns, other possible features for JDK 20 include universal generics and string templates.
JDK 20 is set to be a short-term feature release, with only six months of Premier-level support from Oracle. JDK 21, due in September 2023, will be a Long-Term Support release, backed by multiple years of support.
https://www.infoworld.com/
No comments:
Post a Comment