What are the new features of java-13?
On September 2019, Oracle released a new version of Java as Java-13. Following are the new features of java-13.
Added FileSystems.newFileSystem Method
- Constructs a new FileSystem to access the contents of a file as a file system.
- This method uses specialized providers that create pseudo filesystems where the contents of one or more files are treated as a filesystem.
- This method first attempts to locate an installed provider in exactly the same manner as the newFileSystem(Path, Map, ClassLoader) method. If found, the provider’s newFileSystem(Path, Map)method is invoked with an empty map to construct the new file system.
- newFileSystem(Path)
- newFileSystem(Path, Map<String, ?>)
- newFileSystem(Path, Map<String, ?>, ClassLoader)
New Japanese Era Name Reiwa
- An instance representing the new Reiwa era has been added to this update. Unlike other eras, there is no public field for this era. It can be obtained by calling JapaneseEra.of(3) or JapaneseEra.valueOf(“Reiwa”). JDK 13 and later will have a new public field to represent this era.
- The placeholder name, “NewEra”, for the Japanese era that started on May 1st, 2019 has been replaced with the new official name. Applications that relied on the placeholder name to obtain the new era singleton (JapaneseEra.valueOf(“NewEra”)) will no longer work. We will get the following error if we try to get the value of ‘NewEra’.
New java.nio.ByteBuffer Bulk get/put Methods Transfer Bytes Without Regard to Buffer Position
- java.nio.ByteBuffer and the other buffer types in java.nio now defines absolute bulk get and put methods to transfer contiguous sequences of bytes without regard to or effect on the buffer position.
Support for Unicode 12.1
This release upgrades Unicode support to 12.1 which includes the following:
- java.lang.Character supports Unicode Character Database of 12.1 level, in which 12.0 adds 554 characters since 11.0, for a total of 137,928 characters. These additions include 4 new scripts, for a total of 150 scripts, as well as 61 new emoji characters. 12.1 adds exactly one character, U+32FF SQUARE ERA NAME REIWA, since 12.0.
- java.text.Bidi and java.text.Normalizer classes support 12.0 level of Unicode Standard Annexes, #9 and #15, respectively.
- java.util.regex package supports Extended Grapheme Clusters based on 12.0 level of Unicode Standard Annex #29.
ZGC(Z Garbage Collector) Maximum Heap Size Increased to 16 TB
- The maximum supported heap size for ZGC was increased from 4 TB to 16 TB.
Configurable Read Timeout for CRLs
- The com.sun.security.crl.readtimeout system property sets the maximum read timeout for CRL retrievals, in seconds. If the property has not been set, or if its value is negative, it is set to the default value of 15 seconds. A value of 0 means an infinite timeout.
New keytool -showinfo -tls Command for Displaying TLS Configuration Information
- A new keytool -showinfo -tls command has been added that displays TLS configuration information.
New String Constants for Canonical XML 1.1 URIs
- New String constants named INCLUSIVE_11 and INCLUSIVE_11_WITH_COMMENTS have been added to the javax.xml.crypto.dsig.CanonicalizationMethod API. These represent the URIs for the Canonical XML 1.1 and Canonical XML 1.1 with Comments algorithms for XML Signature.
JEP(JDK Enhancement Proposal) 354 Switch Expressions (Preview Only)
- Extend switch so it can be used as either a statement or an expression, and so that both forms can use either traditional case… : labels (with fall through) or new case… -> labels (with no fall through), with a further new statement for yielding a value from a switch expression. These changes will simplify everyday coding, and prepare the way for the use of pattern matching in switch. This is a preview language feature in JDK 13.
JEP(JDK Enhancement Proposal) 355 Text Blocks (Preview Only)
- Add text blocks to the Java language. 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 desired. This is a preview language feature in JDK 13.
New Methods for Creating DOM and SAX Factories with Namespace Support
- New methods have been added for instantiating DOM and SAX factories with Namespace support by default. These methods are prefixed over their existing counterparts with “NS,” which stands for NamespaceAware. Below is a list of the new methods:
- newDefaultNSInstance()
- newNSInstance()
- newNSInstance(String factoryClassName, ClassLoader classLoader)
- Using these new methods, a parser created through the factory will be NamespaceAware by default. For example, the following statement:
Also, see:
- New features of Java-8
- New features of Java-9
- New features of Java-10
- New features of Java-11
- New features of Java-12