JDK 23: The new features in Java 23



For JDK 23, Java’s builders removed mid-level methods that duplicated low-level methods or were infrequently used, while renaming the remaining mid-level methods to improve usability. They also refined the ClassSignature class model, which has been improved to model the generic signatures of superclasses and superinterfaces more accurately. According to the OpenJDK proposal behind this feature, the Java platform should define and implement a standard class-file API that evolves together with the class-file format, which can evolve every six months.

Also cited for inclusion in JDK 23 is another preview feature, primitive types in patterns, instanceof, and switch. This feature would enhance pattern matching by allowing primitive type patterns in all pattern contexts, and extend instanceof and switch to work with all primitive types. Goals include providing easy-to-use constructs that eliminate the risk of losing information due to unsafe casts; aligning pattern types with instanceof; aligning instanceof with safe casting; allowing uniform data exploration by allowing type patterns for all types, whether primitive or reference types; allowing pattern matching to use all primitive type patterns in nested and top-level contexts; and following the enhancements to switch in Java 5 (enum switch) and Java 7 (string switch) to process values of any primitive type.

String templates, which was previewed in both JDK 22 and JDK 21, was dropped from consideration for JDK 23. The feature was intended to complement Java’s string literals and text blocks by coupling literal text and embedded expressions to produce specialized results. The OpenJDK community felt the capability was “not pulling its weight” and that further evaluations and a potential redesign would take time. 

Latest articles

spot_imgspot_img

Related articles

Leave a reply

Please enter your comment!
Please enter your name here

spot_imgspot_img