Posted On: Mar 22, 2022
Amazon Corretto 18 is now generally available. This version supports the latest Java feature release OpenJDK 18 and is available on Linux, Windows, and macOS. You can download Corretto 18 from the downloads page. Amazon Corretto is a no-cost, multi-platform, production-ready distribution of OpenJDK. Corretto is distributed by Amazon under an open source license.
OpenJDK 18 offers a new Internet-Address resolution capability, a Simple Web Server, an updated Vector API, a new @snippet Tag for JavaDoc, a new implementation of Core Reflection, a change to UTF-8 as the default character set (charset) of the standard Java APIs, a second iteration of the foreign memory API, advancements in pattern matching for switch statements, and the deprecation of finalization.
- The new Service Provider Interface (SPI) enables developers to specify an internet-address resolver other than the default one built into the JVM. The primary advantage is that it will mitigate a blocking issue related to an operating system call that currently occurs when performing internet-address translation. This will be of particular help to applications that use virtual threads.
- The Simple Web Server included in OpenJDK 18 will provide a command line tool to provide static files. Developers can use it for prototyping, ad-hoc coding, and testing.
- A Vector API was initially introduced in OpenJDK 16. It was improved in OpenJDK 17, and it has been further enhanced in OpenJDK 18. The latest version includes support for the ARM Scalar Vector Extension (SVE) Platform and improves the performance of vector operations.
- A new capability that allows the developer to add source code examples in JavaDocs has been added. By using the @snippet annotation, the developer can add code fragments to their documentation.
- OpenJDK 18 contains an update for the way reflection is implemented. The change moves java.lang.reflect.Method, Constructor, and Field to the java.lang.invoke method handles, making method handles the underlying way reflection is performed.
- OpenJDK 18 uses UTF-8 as the default charset of the standard Java APIs. This enables APIs to work in a more predictable fashion when the optional charset attribute is not passed to APIs.
- With OpenJDK 18, a new API has been introduced to enable developers to interoperate with code and data external to the JVM, without the use of the Java Native Interface (JNI). This is a follow-on to an incubating API launched in OpenJDK 17, and it adds a number of improvements to the previous iteration.
- A second preview of Pattern Matching for switch statements is included in OpenJDK 18. The initial launch of this feature was included in OpenJDK 17. With OpenJDK 18, it has been improved by allowing patterns to appear in case labels, enabling the introduction of previously new capabililties, and allowing for developer-defined nullity behavior.
- Finalization will be removed in a future JDK release, and with OpenJDK 18 the feature is deprecated.
A list of these features with more details can be found here.