Thursday, August 20, 2020

JDK 11 migration

 The deployment stack pertaining to applets has been removed from JDK while this was marked deprecated in Java 9. This eliminates the need to support browsers for this stack. Java FX and Java Mission Control are available separately.

The arrays implementation in Java 11 gained performance from Aarch64 intrinsics. This is not as much as offloading to hardware as it is about inlining instructions so that the overall context swapping operations are reduced. Even mathematical functions like sin, cos and log are significantly faster with JDK 11 than JDK 8

Java 11 provides ‘nests’ This is an access control context which works with the nested types in Java programming language. It allows code that is compiled into different classes to not require bridge method to access each other’s private members. Java nested classes have often been used by developers to group classes in the same file assuming that they are part of the same “entity”.  This technique allows those classes to not require access methods for each other.

The Java 11 compiler generates the bridge methods automatically.  These methods appear in both the outer class as well as the inner class.  These methods appear like this: access$000(). The public methods on the inner class go through this method to call the outer class. An invocation of the private member is is compiled into instructions invoking the bridging method in the target class which in turn invokes the intended private method. Compiler generated bridging methods are not visible to reflection. 

The Compatibility between JDK 11 and JDK 8 has multiple levels. Typically, only the source compatibility is reviewed. If it compiles, it might still not be behaviorally equivalent. At the next level, even if it does have behavioral equivalency, it might not have binary preserving equivalency. Once there is binary preserving equivalency, the migration can be called equivalent. However, it still does not guarantee runtime compatibility.

Behavioral compatibility is defined as the compatibility that preserves the semantics of the code. The source level compatibility was merely about translating java code to classes. Binary compatibility is defined based on linkage. If it links one module and continues to link with another module, then the change made in the other module is binary compatible. Runtime compatibility is when all the modules are loaded and behave the same way.


No comments:

Post a Comment