Sunday, February 12, 2023

What's new in JDK 12(my short version)

Oracle Release Notes
Java SE 12 Final Release Specification
Java API Diff page: +,-,change

New Features and Enhancements

- added support for Unicode 11
- core-libs/java.text: Support for Compact Number Formatting(example: 1000 as 1K). CompactNumberFormat class. NumberFormat class has 2 additional methods related to compact (getCompactNumberInstance)
- TypeDescriptor interface added, though for me wasn't clear the use case. Might be related to some class file internals.
- hotspot/gc: ZGC Concurrent Class Unloading, for lowering the overall footprint of the application
- tools/javac: JEP 325 Switch Expressions (Preview, must be enabled) As statement or expression. Precursor to pattern matching.
Example(taken from JEP) from:

switch(day){
    case MONDAY:
    case FRIDAY:
    case SUNDAY:
        System.out.println(6);
        break;
    case WEDNESDAY:
        System.out.println(9);
        break;
}

to:

switch (day) {
    case MONDAY, FRIDAY, SUNDAY -> System.out.println(6);
    case WEDNESDAY              -> System.out.println(9);
}

Switch expression:

int numLetters = switch (day) {
    case MONDAY, FRIDAY, SUNDAY -> 6;
    case WEDNESDAY              -> 9;
};
- core-libs/java.lang.invoke: JEP 334 JVM Constants API: Constable, ClassDesc, ConstantDesc etc. within java.base
Most JDK classes have changes related to constable.
- 2 new methods in String class: indent and transform
- File.mismatch(java.nio.file.Path,java.nio.file.Path). Finds and returns the position of the first mismatched byte in the content of two files, or -1L if there is no mismatch
- CompletableFuture, added new methods: exceptionallyAsync, exceptionallyCompose, exceptionallyComposeAsync
- Collectors.teeing​ -> Returns a Collector that is a composite of two downstream collectors


- core-libs/java.lang: POSIX_SPAWN Option on Linux
- core-libs/java.util:i18n: Square Character Support for Japanese New Era
- hotspot/gc: Allocation of Old Generation of Java Heap on Alternate Memory Devices
- hotspot/runtime: HotSpot Windows OS Detection Correctly Identifies Windows Server 2019 (Prior to that it was detected as 2016)
- hotspot/runtime: Command-Line Flag -XX+ExtensiveErrorReports (more extensive reporting + sensitive)
- security-libs/java.security: disallow and allow Options for java.security.manager System Property
- security-libs/java.security: -groupname Option Added to keytool Key Pair Generation
- security-libs/java.security: New Java Flight Recorder (JFR) Security Events
- security-libs/java.security: Customizing PKCS12 keystore Generation
- security-libs/javax.net.ssl: ChaCha20 and Poly1305 TLS Cipher Suites
- security-libs/org.ietf.jgss:krb5: Support for dns_canonicalize_hostname in krb5.conf
- tools: jdeps --print-module-deps Reports Transitive Dependences


Removed Features and Options

- client-libs/java.awt: Removal of com.sun.awt.SecurityWarning Class
- core-libs/java.io: Removal of finalize Methods from FileInputStream and FileOutputStream.
The java.lang.ref.Cleaner has been implemented since JDK 9 as the primary mechanism to close file descriptors that are no longer reachable from FileInputStream and FileOutputStream. The recommended approach to close files is to explicitly call close or to use try-with-resources.
- core-libs/java.util.jar: Removal of finalize Method in java.util.ZipFile/Inflator/Deflator
- infrastructure/build: Dropped the YY.M Vendor Version String from Oracle-Produced Builds

java 11 2018-09-25
Java(TM) SE Runtime Environment 18.9 (build 11+28)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11+28, mixed mode)

compared to the new one:

java 12 2019-03-19
Java(TM) SE Runtime Environment (build 12+17)
Java HotSpot(TM) 64-Bit Server VM (build 12+17, mixed mode)

- security-libs/java.security: Removal of GTE CyberTrust Global Root
- tools/javac: Removal of javac Support for 6/1.6 source, target, and release Values

Deprecated Features and Options, Other Notes and Differences between Oracle JDK and OpenJDK not included, except:
- hotspot/gc: G1 May Uncommit Memory During Marking Cycle - returning heap to OS
- security-libs/javax.net.ssl: Distrust TLS Server Certificates Anchored by Symantec Root CAs

No comments:

Post a Comment

Please comment strictly on the post and its contents. All comments that do not follow this guideline or use this blog as advertising platform, which made me enable moderation, will not be accepted.