On March 22, Oracle officially released the official version of JDK 18/Java 18. In terms of performance, stability and security, Java 18 has been comprehensively improved and improved, including nine JDK enhancements (JEP) to the platform, which greatly improves the work efficiency of developers.

It is understood that JDK 18 is a short-term maintenance release and will receive six months of support. Still, it can be used in production environments.

The JDK 18 release includes a total of 9 JEPs, as well as hundreds of smaller enhancements and over a thousand bug fixes.

JDK improvements

Default encoding is UTF-8

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

Simple Web Server

A command line tool and API to start a minimal web server that only serves static files. Can be used for prototyping, ad hoc coding and testing purposes, especially in educational settings.

Reimplementing core reflection with Method Handles

Reimplement java.lang.reflect.Method, Constructor and Field based on the java.lang.invoke method handle. By dealing with the underlying mechanism of reflection, the maintenance and development costs of the java.lang.reflect and java.lang.invoke APIs are reduced.

Internet Address Resolution SPI

Defines a Service Provider Interface (SPI) for hostname and address resolution so that third-party resolvers can be used by java.net.InetAddress.

JEP code snippets from the Java API documentation

The @snippet tag was introduced for JavaDoc's standard Doclet to simplify example source code in API documentation.

Follow-up JDK update notice

Vector API (3rd incubation)

Provides an API for developers to provide a scalable CPU architecture with better performance than non-scalable processors.

External functions and memory API (incubating the second time)

Introduces an API that enables Java programs to interoperate with other data. This API enables Java programs to call native libraries and process native data without the fragility and Danger.

Pattern matching for Switch (preview the second time)

Enhances the Java programming language with pattern matching for switch expressions and statements, and extensions to the pattern language. Extending pattern matching into switch allows expressions to be tested against multiple patterns, each with a specific action, so that complex data-oriented queries can be expressed concisely and safely.

Deprecate Finalization for future removal

Finalization is currently still enabled by default, but can be disabled for easier testing. It will be disabled by default in a future version, and will be removed completely after that. Maintainers of libraries and applications that rely on Finalization should consider migrating to other resource management techniques, such as try-with-resources statements.


snakesss
1.1k 声望244 粉丝

SegmentFault 思否编辑,欢迎投稿优质技术资讯!