The initial release of Java 11 was in 25th September 2018, and Java 11.0.1 was released in 16th October 2018 with security updates and bug fixes. The latest version of Java has brought in a plethora of features, and every new version of Java brings in new things and gets rid of some of the old stuff. That is exactly why Java is still the leader in the programming world. The version features 3 JEPs which are contributed by the Java community and this marks as the biggest external contribution ever. As per the press release, these JEPs are bringing in 17 different enhancements to make the programming language better for corporate development.
New Features in Java 11 –
No-Op Garbage Collector – This is a new and upgraded garbage collector, and it efficiently manages memory allocation. It is achieved by not implementing the memory reclamation mechanism. It is going to be extremely useful for distributed systems as they generally have lots of short-lived services. However, once the Java heap is exhausted, JVM shuts down. Along with that, Java 11 sees the release of the experimental version of a scalable low-latency garbage collector. The prominent version might come in Java 12.
Flight Recorder – This is a brand new feature, and it is actually a low overhead data collection framework. It will help in troubleshooting Java applications. There are different goals this move has like providing APIs for using data as events, providing a better buffer mechanism, allowing filtering of events, and finally providing events with OS and JDK libraries. There are many indirect goals like the visualization of collected data and making data collection by default.
Dynamic File Class Constant – It is a new constant-pool form leading to the delegation of the creation to a bootstrap method. It is going to lower the disruption of creation materializable class-file constants and therefore, the performance will enhance. Moreover, it is likely to make the link-time handshake between bootstrap methods and JVM better.
Local Variables For Lambda Paramters – The new Java version will allow local variables usage while declaring formal parameters of an implicit lambda expression. The main goal is to align the syntaxes of the local variable declaration to that of the formal parameter declaration in the lambda expression.
Library Functions –
asMatchPredicate – We had asPredicate() function in Java 8 to create a predicate when there is a match of a certain pattern in a given string. The new asMatchPredicate() will create a predicate when there is a pattern match for a given input string.
isSameFile – This function returns true if two paths locate the same file.
readString – This function will read a file into a string, and therefore, it decodes bytes to characters. Once the file is read completely, it is closed. Even when there is an error or exception, it is closed.
writeString – This function is to write contents to a file. The characters are encoded into bytes.
stripLeading is for removing whitespace from a string’s beginning while stripTrailing is for removing from the end of the string.
isBlank is for checking empty and white spaces in a string. Apart from that, there are lines() and repeat(n) new functions.
Apart from this, there is a low-overhead heap profiling introduced and a new version of Transport Layer Security available.
On the flip side, there are a few things that have been removed from Java completely. They are Java EE and COBRA modules, Web Start feature, Applets, and JavaFX. Applets were heavily deprecated while FC libraries are moved to OpenJFX from the core Java. Therefore, the development teams need to check carefully while upgrading to Java 11 of any changes needs to be made in the script to make the application made in Java smoothly.