Monday, November 1, 2021

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

Link to the Oracle release notes: Oracle Release Notes

New Features
- java-util: Optional.orElseThrow() - preferred alternative to get()
- APIs for Creating Unmodifiable Collections: List.copyOf, Set.copyOf, Map.copyOf.
Stream Collectors have additional have additional toUnmodifiableList, toUnmodifiableSet, toUnmodifiableMap methods.
- System property to disable JRE last usage tracking
- Hashed passwords for out of the box JMX Agent in jmxremote.password using SHA3-512
- Garbage collection: improvement in G1 worst-case latencies by making the full GC parallel.
- Root certificates: added certificates to the cacerts keystore so that TLS connections can be established
- TLS Session Hash and Extended Master Secret Extension Support
- bytecode generation improvement for Loop
- Javadoc tool additions, like --add-stylesheet, --overridden-methods=value, @summary tag for usage in specifying the text summary of the API description.

Java Specification Request (JSR) 383: Source

Java Enhancement Proposal (JEP) 314:
- In addition to Java SE 9 added ca and nu BCP 47 U Language-tag extensions, JEP 314 added:
a) cu (currency type)
b) fw (first day of week)
c) rg (region override)
d) tz (time zone)

JEP 322: Time-Based Release Versioning
Necessary for the six-month release cadence
$FEATURE.$INTERIM.$UPDATE.$PATCH
compared to Java 9 Release Scheme:
$MAJOR.$MINOR.$SECURITY

$FEATURE is incremented every six months.
$INTERIM is always zero, since the six-month model does not include interim releases. We reserve it here for flexibility
$UPDATE is incremented one month after $FEATURE is incremented, and every three months thereafter
$PATCH — The emergency patch-release counter, incremented only when it's necessary to produce an emergency release to fix a critical issue.

JEP 286: Local-Variable Type Inference
Infer type to declarations of local variables with initializers. Examples:
var list = new ArrayList<String>();
var stream = list.stream();

Removed Features:
- javax.swing: Removal of Swing Old LookAndFeel
- java.lang: Removal of Runtime.getLocalizedInputStream and Runtime.getLocalizedOutputStream.
- java.rmi: removal of RMI server-side multiplex protocol support
- Removal of common DOM APIs: com.sun.java.browser.plugin2.DOM and sun.plugin.dom.DOMObject
- Removal of FlatProfiler, which was enabled by settings the -Xprof VM argument
- Removal of Obsolete -X Options: -Xoss, -Xsqnopause, -Xoptimize, -Xboundthreads, -Xusealtsigs
- Removal of javafx/application-lifecycle: HostServices::getWebContext method
- javafx/graphics: Removal of T2K Rasterizer and ICU Layout Engine From JavaFX
- javafx/media: Removal of Deprecated VP6/FXM/FLV Code from Java FX
- java.security: Removal of Deprecated Pre-1.2 SecurityManager Methods and Fields
- java.security: Removal of policytool
- javax.security: Removal of Deprecated Classes in com.sun.security.auth.**
- javadoc: Removal of Old standard Doclet which outputs HTML content.
- Removal of the native-header generation tool javah
- Removal of Java Launcher Data model options -d32 and -d64

Deprecated Features and Options (forRemoval=true and forRemoval=false)
- jdk.snmp module (SNMP monitoring and management support for the JVM)
- java.security.{Certificate, Identity, IdentityScope, Signer}
- java.security.acl
- javax.security.auth.Policy

Other Notes:
- Class file version from 53(44+9) to 54(44+10)
- java.awt touch keyboard for Swing/AWT text components on Windows 8 or later.
- java.awt.TrayIcon.displayMessage() reimplemented on macOs to use standard notification center instead of a custom window
- Changes on how finalize calls close on FileInput/OutputStream (relaxation)
- -Xbootclasspath/a will make bootstrap class loader to skip empty element when locating resources
- RMI Registry Filter Allows binding arrays of any type now, and the maximum size increased to 1 million.
- Added javax.management.MBeanOperationInfo.MBeanOperationInfo impact parameter validation.
- TraceYoungGenTime and TraceOldGenTime have been removed. Same info available through Unified Logging with tag-set gc+heap+exit at debug level
- Set BiasedLockingStartupDelay to 0 instead of 4000ms
- Improvements for Docker Containers: modified JVM to be aware that it is running inside docker container. Linux only. Several JVM options available regarding CPU and RAM.
- org.ietf.jgss:krb5: Accept including .conf files in krb5.conf
- javac: New Class AST Node With enclosing Instance
- javac: Error Message When java.lang.IllegalAccessError Produced (when external tools have loaded javac classes with multiple classloaders)
- javadoc: Treating Failure to Access a URL as an Error instead of warning.
- javadoc: HTML Files in doc-files Subdirectories Wrapped with Standard javadoc Decorations.
- jshell: reduced time needed to start JShell.
- xml: XMLInputFactory.newFactory Incorrectly Deprecated in Java 9 and deprecation removed
- xml/jaxp: java.xml APIs With Raw Types were updated to add a type parameters

Sunday, November 15, 2020

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

1.Java platform module system
- optional phase, link time, between compile and run time.
- options to javac, jlink and java where you can specify module paths
- modular JAR file, which is a JAR with module-info.class in root dir
- JMOD format, which can include native code compared to JAR
- JDK divided into modules, thus enabling combination of modules.
- new URI scheme for naming modules, classes and resources stored in a runtime image without revealing the internal structure or format of the image.
- Removes rt.jar and tools.jar from the Java runtime.
- Makes most JDK internal APIs inaccessible by default, with some widely used exceptions.

2.New version-string scheme. $MAJOR.$MINOR.$SECURITY.$PATCH
- A major release contains new features and changes to existing features, which are planned and announced well in advance - A minor version number that is incremented for each minor update, such as bug fixes, revisions to standard APIs or implementation of features outside the scope of the relevant platform specifications
- Security is the version number that is incremented for a security-update release, which contains critical fixes, including those necessary to improve security. PATCH is the version number that is incremented for a release containing security and high-priority customer fixes that have been tested together

3.Language features
- @SafeVargs annotation
- effectively final variables to be used in try with resources
- support for private interface methods.

4.JVM
- G1 improvements.
- common logging system.
- G1 made Default.
- Concurrent Mark Sweep is deprecated.

5.Core
- Improvements on the OS Processes API
- Changed internal representation of strings from char array with 2 bytes for each character to a byte array plus encoding flag field.
- Minimal logging API that can be defined by apps to route logging to library of choice, or default to java.util.logging is used.
- Easier to make collections of small number of elements, like Set.of("","","")
- @Deprecated interface gets new parameters, like since and forRemoval.
- New API that can be used to hind that a spin loop is executing, this info being available for futher use for performance improvements.
- Stack walking API. Easy access to the information in stack traces.
- Support for 2.11.0 Xerces parser.

6.Nashorn
- Allows apps to parse and analyze ECMAScript code, parsing returns Abstract Syntax Tree.
- Implements features introduced in ECMAScript 6, like:
   a)template strings
   b)let, const and block scope
   c)iterators and for..of loops
   d)Map, Set, WeakMap, WeakSet
   e)Symbols
   f)Binary and Octal literals

7.Client Technologies
- Supports in AWT for multi resolution images, in order to adapt to different devices.
- public APIs for JavaFx UI controls and CSS that were previously available only through internal packages.
- @beaninfo replaced with JavaBean, BeanProperty, SwingContainer
- Add TIFF as standard to javax.imageio
- Automatic scale and size of AWT and Swing components to HiDPI on Windows and Linux.
Prior, apps were sized and rendered based on pixels, which led to components too small to read or use.
- New methods to java.awt.Desktop

8.Internationalization
- Support for Unicode 8.0. JDK 8 supported 6.2. 10555 more chars, 29 scripts and 42 blocks.
- Use of Common Locale Data Repository XML based locale data, which was added in JDK 8, as default. Previously, JRE was used.
- Loads properties files in UTF-8. Previously ISO-8859-1 was used. UTF-8 is better at representing non-Latin characters.