Oracle has released Java 18, the most recent version of this popular programming language and development platform. Thousands of speed, stability, and security improvements are included in Java 18 (Oracle JDK 18), including nine platform advancements intended to boost developer productivity even further.
With nine JDK Enhancement Proposals, the newest Java Development Kit (JDK) brings updates and enhancements (JEPs). These include the ability to insert Code Snippets in Java API Documentation (JEP 413), which would make it easier to include sample source code in API documentation, and the Simple Web Server (JEP 408), which is used for prototyping and testing. Developers can look at two incubation modules: the Vector API (JEP 417) and the Foreign Function and Memory API (JEP 419), as well as a preview feature called Pattern Matching for Switches (JEP 420).
“Java developers want continued innovation with modern programming language features, developer experience enhancements, cloud managed services, and stability,” said James Governor, Principal Analyst, RedMonk. “With Java’s consistent six-month release cadence Oracle is meeting those demands, helping to keep Java relevant for modern applications and workloads.”
Accelerating Java’s Adoption in the Cloud
Java Management Service (JMS), a new Oracle Cloud Infrastructure (OCI) native service, was recently released to assist manage Java runtimes and applications on-premises or in any cloud. JMS provides the data required to manage Java deployments throughout an organization. For OCI workloads and Java SE Subscribers, Java Management Service is included.
Java 18 is the most recent release in Java’s six-month cycle. It’s the product of substantial cooperation between Oracle engineers and other members of the global Java development community through the OpenJDK Project and the Java Community Process (JCP). This would ensure a continual stream of innovations while also bringing continuing performance, stability, and security enhancements, ensuring Java’s widespread adoption across all companies and sectors. The following are the most significant changes in Java 18:
Updates and Improvements to Libraries
- JEP 400: UTF-8 by Default – Sets UTF-8 as the standard Java APIs’ default charset. APIs that rely on the default charset will now act similarly across all implementations, operating systems, locales, and settings as a result of this change.
- JEP 408: Simple Web Server – A command-line program and API for running a simple web server that only serves static files. This tool will be particularly useful in educational settings for prototyping, ad-hoc coding, and testing.
- JEP 416: Reimplement Core Reflection with Method Handles – Java.lang.reflect is reimplemented. On top of the java.lang.invoke method handle, there are methods, constructors, and fields. It would lower the maintenance and development costs of both the java.lang.reflect and java.lang.invoke APIs by having method handle the underlying mechanism for reflection.
- JEP 418: Internet-Address Resolution SPI – To allow java.net to resolve host names and addresses, it defines a service-provider interface (SPI). Other resolvers beyond the platform’s built-in resolver can be used by InetAddress.
- JEP 413: JEP Code Snippets in Java API Documentation – The @snippet element is added to JavaDoc’s Standard Doclet to make it easier to provide sample source code in API description.
Preview and Incubators for Later JDK Releases
- JEP 417: Vector API (Third Incubator) – Provides an API for developers to take use of CPU architectures that support scalable vector extensions with confidence. When compared to comparable computations on non-extended CPUs, this would result in better performance.
- JEP 419: Foreign Function and Memory API (Second Incubator) – Allows Java programs to communicate with code and data that is not part of the Java runtime. The API allows Java applications to contact native libraries and handle native data without the brittleness and hazards of JNI by effectively executing foreign functions (code outside the JVM) and safely accessing foreign memory (memory not maintained by the JVM).
- JEP 420: Pattern Matching for Switch (Second Preview) – Pattern matching for switch expressions and statements, as well as enhancements to the pattern language, are added to the Java programming language. Extending pattern matching to switch allows an expression to be checked against a number of patterns, each with a different action, allowing for the succinct and safe representation of complicated data-oriented queries.
Future Proofing Java Programs
- JEP 421: Deprecate Finalization for Removal – For the time being, finalization is enabled by default, although it may be removed to make testing easier. It will be deactivated by default in a future release, and it will be eliminated in a later release. Maintainers of libraries and applications that rely on finalization should consider using cleaners or the try-with-resources statement instead.
“The release of Java 18 demonstrates Oracle’s continued commitment to provide enterprises and developers faster access to enhancements with the six-month feature release cadence,” said Georges Saab, Vice President of Development, Java Platform Group, Oracle. “We continue to make technical investments that improve the performance, stability, and security of the Java SE Platform implementations, as well as the Java Development Kit.”