Java, first released a little over 25 years ago on January 23, 1996, was created as a modern programming language for the Internet era. Its "write once, run anywhere" mantra brought it popularity on mobile and multimedia devices, while its strength and versatility saw it become a major player in enterprise application development.
Minecraft, Wikipedia search, Netsuite, the Maestro Mars Rover controller, the Eclipse IDE, significant portions of Android, and more, are all notable Java applications in use today.
Oracle updates Java every six months, providing developers with a predictable and planned release schedule, giving a steady stream of innovations and continued performance, stability, and security enhancements.
“The power of the six-month release cadence was on full display with the latest release,” Georges Saab, vice president of development, Java Platform Group, Oracle. “Pattern Matching and Records were introduced a year ago as part of JDK 14 and have since gone through multiple rounds of community feedback based on real-world applications. This process has not only given Java developers the opportunity to experiment with these features before they were finalised but also incorporated that critical feedback which has resulted in two rock-solid JEPs that truly meet the needs of the community.”
The Java 16 release is the result of extensive collaboration between Oracle engineers and members of the OpenJDK Community and the Java Community Process.
New features in Java 16 include:
- Pattern matching for the instanceof operator.
- New language feature records, which are classes acting as transparent carriers for immutable data.
- The jpackage tool, for packaging self-contained Java applications.
- Elastic Metaspace, returning unused HotSpot class-metadata memory to the operating system more promptly, with associated benefits.
- ZGC Concurrent Thread-Stack Processing, moving ZGC thread-stack processing from safepoints to a concurrent phase, and eliminating the last significant bottleneck for concurrent stack processing.
- UNIX-Domain Socket Channels, adding support for all of the features of UNIX-domain sockets common across the major UNIX platforms and Windows to the socket channel and server-socket channel APIs in the java.nio.channels package. UNIX-domain sockets are used for inter-process communication (IPC) on the same host. They operate similarly to TCP/IP sockets for the most part except they are addressed by filesystem pathnames instead of IP addresses and port numbers.
- Strongly Encapsulate JDK Internals by Default, building on previous work to strongly encapsulate new internal API elements and limit access to them. Now most internal elements of the JDK are encapsulated by default, encouraging developers to migrate from using internal elements to standard APIs. This enhances security and provides future-proof software.
- Warnings for Value-Based Classes, designating the primitive wrapper classes as value-based and deprecate their constructors for removal, prompting new deprecation warnings.
- Vector API (Incubator), providing an initial iteration of an incubator module, jdk.incubator.vector, to express vector computations that reliably compile at runtime to optimal vector hardware instructions on supported CPU architectures.
- Foreign Linker API (Incubator), Introducing an API that offers statically-typed, pure-Java access to native code.
- Foreign-Memory Access API (Third Incubator), introducing an API to allow Java programs to safely and efficiently access foreign memory outside of the Java heap.
- Sealed Classes (Second Preview), enhancing the Java programming language with sealed classes and interfaces. Sealed classes and interfaces restrict which other classes or interfaces may extend or implement them.
OpenJDK enhancements include:
- Enable C++14 Language Features (in the JDK C++ source code).
- Migrate from Mercurial to Git, migrating the OpenJDK Community’s source code repositories from Mercurial (hg) to Git.
- Migrate to GitHub, hosting the OpenJDK Community’s Git repositories on GitHub.
Enhanced support for a wider range of platforms includes:
- Alpine Linux Port, porting the JDK to Alpine Linux, and to other Linux distributions that use musl as their primary C library, on both the x64 and AArch64 architectures.
- Windows/Aarch64 Port, porting the JDK to Windows/AArch64.
- Enterprise subscribers also receive an entitlement to GraalVM, helping improve performance and reduce resource consumption by applications, particularly cloud-native and microservice architectures.
"Instead of getting interested every three or four years about what was new in Java, this cadence keeps me active as a passionate developer, teacher and trainer,” said José Paumard, Assistant professor, University Sorbonne Paris Nord and co-organiser, Paris Java User Group. “I have eagerly awaited using Records to improve the performance and readability of my data processing code, and after being able to use it as a preview feature, it is now going live with this latest release."
Developers can learn more about Java 16 and get hands-on experience at Oracle Developer Live: Java Innovations on March 23, 25 and 30.
You can read more detail in the Java Technical Blog, and you can find out more about the new language feature, records, in this official Oracle video below.