JDK 18 / Java 18 GA is released

JDK 18 / Java 18 GA is released. JDK 18 is a short-term maintenance release that will receive six months of support. Despite this, it is still available for use in production environments. According to the development plan, JDK 19 will be released this September, and the next LTS version, JDK 21, will be released in September 2023.

JDK 18 includes a total of nine JEPs, as well as hundreds of smaller enhancements and more than a thousand bug fixes.

400: UTF-8 by Default
408: Simple Web Server
413: Code Snippets in Java API Documentation
416: Reimplement Core Reflection with Method Handles
417: Vector API (Third Incubator)
418: Internet-Address Resolution SPI
419: Foreign Function & Memory API (Second Incubator)
420: Pattern Matching for switch (Second Preview)
421: Deprecate Finalization for Removal

Default encoding to UTF-8

Specify UTF-8 as the default character set for the standard Java API. With this change, APIs that rely on the default character set will be consistent across all implementations, operating systems, language environments, and configurations.

Simple HTTP Server

Provides command line tools to start a minimal web server that serves only static files. There is no CGI or servlet-like functionality available. The tool can be used for prototyping, ad hoc coding, and testing purposes, especially in educational environments.

Code snippets from Java API documentation

Introduce a @snippet tag for JavaDoc’s Standard Doclet to simplify the sample source code in API documentation.

Reimplementing Java Core Reflection with Method Handles

Reimplementing java.lang.reflect, Method, Constructor, and Field on top of java.lang.invoke method handles will reduce the maintenance and development costs.

Vector API (incubated for the third time)

Introduce an API to express vector computation that compiles reliably at runtime, optimizing vector instructions on supported CPU architectures to achieve better performance than scalar computation.

Internet Address Resolution SPI

Define a Service Provisioning Interface (SPI) for host name and address resolution so that java.net.InetAddress can use a resolver other than the platform’s built-in resolver.

External function and memory API (incubated for a second time)

Introduce an API through which Java programs can interoperate with code and data outside of the Java runtime. By efficiently calling external functions and safely accessing external memory, this API enables Java programs to call local libraries and work with local data without the vulnerabilities and dangers of JNI.

Switch pattern matching (second time for preview)

Enhance the Java programming language with pattern matching for switch expressions and statements, and extensions to the pattern language. Extending pattern matching to switch allows expressions to be tested against a number of patterns so that complex data-oriented queries can be expressed concisely and safely. This is a preview language feature in JDK 18.

Deprecate Finalization for future removal

Deprecate Finalization to remove it in a future release. For now Finalization is still enabled by default, but it can be disabled for early testing. In later releases, it will be the first to be disabled by default, and will be removed completely in future releases. Maintainers of libraries and applications that rely on Finalization should consider migrating to other resource management techniques, such as the try-with-resources statement.

More details can be found at: https://openjdk.java.net/projects/jdk/18/

Download: https://jdk.java.net/18/