Navigation
Recherche
|
Oracle reveals five new features coming to Java
mardi 18 mars 2025, 22:36 , par InfoWorld
With JDK (Java Development Kit) 24 having just reached general availability, Oracle has given a sneak peek at Java features set to arrive in the not-too-distant future, ranging from enhanced primitive boxing to null-restricted value class types.
Oracle on March 18 cited five features that were being prepared for an upcoming Java release, including stable values, an API that has been officially targeted for the JDK 25 release due this September. The other two features cited include value classes and objects and derived record creation. JDK Enhancement Proposals (JEPs) have been published for all five features, which are now in a preview stage: Enhanced primitive boxing uses boxing to support language enhancements that treat primitive types more like reference types. Goals include allowing boxing of primitive values when they are used as the “receiver” of a field access, method invocation, or method reference, and allowing unboxed return types when overriding a method with a reference-typed return. Also, primitive types would be supported as type arguments. Null-restricted value class types allow the type of a variable that stores value objects to exclude null, enabling more compact storage and other optimizations at run time. Null-restricted value class types are being previewed as both a language feature and a virtual machine feature. Value classes and objects enhance the Java platform with value objects, which are class instances that have only final fields and lack object identity. Goals include allowing developers to opt in to a programming model for simple values, in which objects are distinguished solely by their field values. The proposal also would maximize the freedom of the JVM to encode simple values in ways that improve memory footprint, locality, and garbage collection efficiency. Derived record creation enhances the language with the ability to create a new record from an existing one. One goal is providing a concise means to create new record values derived from existing record values. Another goal is streamlining the declaration of record classes by eliminating the need to provide explicit wither methods, which are the immutable analogue of setter methods. Stable values are objects that hold immutable data. Because stable values are treated as constants by the JVM, they allow for the same performance optimizations that are enabled by declaring a field final. At the same time, they offer greater flexibility as to the timing of initialization. Goals of the proposal include improving the startup of Java applications by breaking up the monolithic initialization of application state.
https://www.infoworld.com/article/3848288/oracle-reveals-five-new-features-coming-to-java.html
Voir aussi |
56 sources (32 en français)
Date Actuelle
mer. 19 mars - 13:00 CET
|