JDK 13: What's new in Java 13

Official Java 13 development goals include improvements to garbage collection, application class data sharing, and text blocks

Original link:  https://www.infoworld.com/article/3340052/jdk-13-the-new-features-coming-to-java-13.html

Java Development Kit (JDK) 13, the next version of standard Java, has reached its first stage where all new features are locked.

[The new Java is coming! Learn about the Jakarta EE enterprise Java roadmap . ]

JDK 13ï¼Java 13çæ°åè½

JDK 13 will be finally released on September 17, 2019. Here are the new features officially available for JDK 13:

  1. Add text blocks during the preview stage. A text block is a multiline string literal that avoids the need for most escape sequences. Text blocks automatically format strings in a predictable way and give developers control over the formatting. The project cites some of the goals behind adding text blocks to Java.
    • One goal is to simplify writing Java programs by making it easy to express strings that span several lines of source code, while avoiding escape sequences in common cases.
    • A second goal is to enhance the readability of strings in programs that represent code written in languages ​​other than Java.
    • A third goal is to support the migration of string literals by stipulating that any new construct can express the same set of strings as a string literal, interpret the same escape sequences, and operate like a string literal. Raw string literals , a feature proposed by JDK 13 but in favor of text blocks, take a different approach to representing strings without escaping newlines and quotes. Raw string literals focus on the rawness of strings, but the Java project team now believes the focus is misplaced because while raw string literals may span multiple lines of source code, they involve the expensive requirement of supporting unescaped delimiters. Raw string literals have been predicted for JDK 13, but never officially added to its list of proposed features.
  2. net.SocketReimplementing the legacy socket API, which would involve replacing the API and java.net.ServerSocketthe underlying implementation used by the API with a simpler, more modern  implementation that is easier to debug and maintain. The new implementation is designed to be easily adapted to use user-mode threads (also known as fibers), which are being explored in Project Loom . The aforementioned legacy API dates back to JDK 1.0 and contains a mix of legacy C and Java code that has been described as a pain to debug and maintain. There were other problems with the legacy implementation: support for asynchronous shutdown, native data structures that caused reliability and porting issues, and concurrency issues that needed to be overhauled. 
  3. JDK 13 presents a second preview of switch expressions. There is one in JDK 12 , but with one change: to switchgenerate a value from an expression break, the with value statement is removed in favor of a  yielddeclaration. The intent is to extend switchit so that it can be used as a statement or an expression, so both forms can use both case ... :traditional tags with sequence notation, and new case … ->tags without passing, and a new statement for switchexpressions from Generate a value in the formula. These changes will simplify coding and prepare  for pattern matching .
  4. Enhanced ZGC (Z Garbage Collector) to return unused memory to the operating system, the referenced proposal was integrated into JDK 13. ZGC is known as a scalable low-latency collector and currently does not return unused memory to the operating system even if the memory has not been used for a long time. This behavior is not optimal for some applications and environments, especially those where memory footprint is of concern, such as containers where the application may be idle for long periods of time and share or compete for resources with other applications or environment.
  5. Extends Application Classes - Data Sharing (AppCDS) to dynamically archive classes at the end of application execution. Archived classes will include all loaded application and library classes that are not present in the default base layer CDS archive. This proposal is at the target stage to improve the usability of AppCDS and remove the need for users to do a trial run to create a class list for each application.

In the current phase, priority 1 to 3 bugs will be fixed, while priority 4 and 5 bugs will be removed.

Certain Priority 1 and Priority 2 bugs may be deferred after approval.

Upcoming stages include a second stage on July 18 and a premiere on August 8.

Where to download beta JDK 13 releases

You can download the JDK 13 release from the jdk.java.net website . The first JDK 13 beta releases are available for Linux, MacOS, and Windows.

Guess you like

Origin blog.csdn.net/ccc7574/article/details/94624450
13