Home  >  Core Java

What are New Features in Java 13

By Arvind Rai, June 25, 2021
Find the new features and enhancements introduced in Java 13 point-by-point.
1. In java.nio.file.FileSystems, three new methods have been added as following.
newFileSystem(Path, Map<String, ?>)
newFileSystem(Path, Map<String, ?>, ClassLoader) 
2. Now java.nio.ByteBuffer define absolute bulk get and put methods to transfer contiguous sequences of bytes without regard to or effect on the buffer position.

3. Now the instance for Japanese Era Name 'Reiwa' can be obtained by calling as below.

4. Java 13 supports Unicode 12.1.

5. Z Garbage Collector (ZGC) has been enhanced to return unused heap memory to the operating system. This feature is enabled by default. To disable it, use command -XX:-ZUncommit .

6. Now we can control the growth of heap beyond the specified size by using command -XX:SoftMaxHeapSize=<bytes> . Currently it works only when Z garbage collector(ZGC) is enabled.

7. The maximum supported heap size for ZGC has been increased from 4TB to 16TB.

8. JEP 350 extends application class-data sharing (AppCDS) to allow the dynamic archiving of classes as a Java application is exiting.

9. Now we can configure read timeout for CRLs using com.sun.security.crl.readtimeout system property. Its default value is 15 seconds. If its value is –ve or this property is absent, the default read timeout is set. If its value is 0, then read timeout is infinite.

10. A new keytool -showinfo -tls command has been added that displays TLS configuration information. TLS is Transport Level Security.

11. The SunMSCAPI provider now supports reading private keys in Cryptography Next Generation (CNG) format.

12. The SunPKCS11 provider has been updated with support for PKCS#11 v2.40.

13. The named elliptic curve groups x25519 and x448 are now available for JSSE key agreement in TLS versions 1.0 to 1.3, with x25519 being the most preferred of the default enabled named groups.

14. Bug JDK-8211018: In Java Secure Socket Extension (JSSE), now session is resumed without server-side state.

15. A security property named jdk.sasl.disabledMechanisms has been added that can be used to disable SASL mechanisms.

16. New String constants named INCLUSIVE_11 and INCLUSIVE_11_WITH_COMMENTS have been added to the javax.xml.crypto.dsig.CanonicalizationMethod API. The INCLUSIVE_11 represents URI for Canonical XML 1.1 and the INCLUSIVE_11_WITH_COMMENTS represents URI for Canonical XML 1.1 with Comments algorithms for XML Signature.

17. The ECKeyValue type as described in the W3C Recommendation for XML-Signature Syntax and Processing is now supported. A new EC_TYPE constant has been added to the javax.xml.crypto.dsig.keyinfo.KeyValue interface.

18. A native GSS-API library has been added to JDK on the Windows platform.

19. The Kerberos client has been enhanced with the support of principal name canonicalization and cross-realm referrals (RFC 6806).

20. JEP 354: The switch expression has been extended to produce value using yield in preview mode.
int day = 2;
String x = switch (day) {
  case 1: 
  yeild  "Monday";
  case 2:
	yeild "Tuesday";
	throw new IllegalStateException("Invalid day: " + day);		
21. JEP 355: Text block is added in preview mode. A text block is a multi-line string literal that avoids the need for most escape sequences and automatically formats the string.
Using "one-dimensional" string literals.
String query = "SELECT `EMP_ID`, `LAST_NAME` FROM `EMPLOYEE_TB`\n" +
               "WHERE `CITY` = 'INDIANAPOLIS'\n" +
               "ORDER BY `EMP_ID`, `LAST_NAME`;\n"; 
Using a "two-dimensional" block of text.
String query = """
               WHERE `CITY` = 'INDIANAPOLIS'
               ORDER BY `EMP_ID`, `LAST_NAME`;
22. New methods have been added for instantiating DOM and SAX factories with Namespace support by default.
newNSInstance(String factoryClassName, ClassLoader classLoader) 
These methods will create factories NamespaceAware by default.
DocumentBuilder db = DocumentBuilderFactory.newDefaultNSInstance().newDocumentBuilder(); 
The above code is equivalent to below code.
DocumentBuilderFactory dbf = DocumentBuilderFactory.newDefaultInstance(); 
DocumentBuilder db = dbf.newDocumentBuilder(); 


JDK 13 Release Notes

©2021 concretepage.com | Privacy Policy | Contact Us