The 25-year-old Java

2020 marks the 25th anniversary of Java. Over the years, Java has provided users with more than two decades of innovation driven by past enhancements, such as generics in Java 5, lambdas in Java 8, and modules in Java 9. These iterations have improved the performance, stability, and security of the Java platform.

Java may be 25 years old, but it continues to innovate. Oracle announced the release of JDK15 on September 15. This is the sixth release since the Java iteration cycle was shortened to six months. As iterations speed up, it makes it easier for Java design and development testers to deal with changes in iterations.

At a pace of six months, the speed at which new production-ready JDK releases are delivered has greatly increased. Instead of releasing thousands of fixes and about a hundred JDK enhancement suggestions (JEP) every few years in a major release.

JDK Enhancement Proposals (JEP) are defined as JDK feature additions and improvement Proposals.

Chinese enterprises have made outstanding contributions

In addition, the OpenJDK community has contributed significantly to the creation of JDK15, including a number of smaller organizations and independent developers in addition to the well-known tech giants.

Oracle is still the leading developer of the JDK, completing 79.68% of the work, followed by open source giant Red Hat. The largest contribution of domestic enterprises was actually Tencent, which was thanked by Oracle. Alibaba and Huawei have also made indelible contributions. Java has the contribution of Chinese technology power and can greatly enhance the hard power of Chinese IT.

Java 15

Java 15 provides users with fourteen major enhancements/changes, including an incubator module, three preview features, two deprecated features, and two delete features.

EdDSA Digital signature algorithm

Edwards-curve digital signature algorithm (EdDSA) is added to implement encryption signature. It is supported in many other encryption libraries, such as OpenSSL and BoringSSL. EdDSA offers higher security and performance than the existing signature schemes in the JDK. This is a new feature.

Hidden classes

This feature helps frameworks that need to generate classes at run time. The framework generates classes that need to dynamically extend their behavior, but it also wants to restrict access to those classes. Hidden classes are useful because they are accessible only through reflection and not from normal bytecode. In addition, hidden classes can be loaded independently of other classes, which can reduce the memory footprint of the framework. This is a new feature.

Reimplement the DatagramSocket API

To realize the old DatagramSocket API, simpler, more modern implementation instead of java.net.DatagramSocket and java.net.MulticastSocketAPI implementation, improve the maintainability and stability of the JDK.

ZGC function becomes positive

ZGC has been integrated into JDK 11 from JEP 333, with the goal of improving performance by reducing GC pause times. With THE help of JEP 377, ZGC moves from a preview function to a production function.

The text block function becomes positive

Text blocks were proposed by JEP 355 in 2019. A text block is a multi-line string literal that avoids the need for most escape sequences, automatically formats the string in a predictable way, and gives the developer control over the format when needed. With JEP 378, text blocks have become a permanent feature of the Java language.

Shenandoah garbage collection algorithm changed to normal

Shenandoah garbage collection went from an experimental feature to a product feature. This is a collection algorithm introduced from JDK 12 that reduces GC pause times by evacuating at the same time as the running Java thread. Shenandoah’s pause time is independent of the heap size and has the same consistent pause time whether the stack is 200 MB or 200 GB.

Seal Class (Preview)

Used to limit the use of superclasses, sealed classes and interfaces restrict other classes or interfaces that may inherit or implement them. This is the new preview feature.

Instanceof Automatic Matching Patterns (Preview)

Before that in Java:

// Determine the type first
if (obj instanceof String) {
    // Then convert
    String s = (String) obj;
    // Then it can be used
}
Copy the code

In automatic matching mode:

if (obj instanceof String s) {
    // Use it directly if the type matches
} else {
    // If the type does not match, it cannot be used directly
}
Copy the code

This is the second preview of the feature, which we first previewed in Java 14.

Records Class(Preview)

This is also the second preview. I’ve described this feature in detail, which you can learn more about in the Java 14 New Features JEP 359 Records article.

External Memory Access API(Preview)

The goal is to introduce an API that allows Java programs to access external memory outside the Java heap safely and efficiently. This is also a preview feature for Java 14.

other

There are other deprecated and deprecated features such as the Nashorn JavaScript engine being removed as well as Solaris and SPARC ports being removed. Some deprecated features have been flagged.

Follow the official account Felordcn for more information

Personal blog: https://felord.cn