Java SE 18 Final Release Specification
Java API Diff page: +,-,change
New Features and Enhancements
- core-libs/java.nio.charsets: UTF-8 by DefaultUTF-8 is the default charset for the Java SE APIs. Prior to that was the one of the system, local and configuration. file.encoding may accept UTF-8 or COMPAT, latter instructing runtime to behave as previous releases.
- core-libs/java.net: Simple Web Server. Minimal static web server for prototyping usage, ad-hoc coding and testing.
- core-libs/java.net: Internet-Address Resolution SPI. For InetAddress to be able to use other host name and address resolution resolvers instead of the platform build-in local hosts file and DNS.
- tools/javadoc(tool): Code Snippets in Java API Documentation. @snippet tag for example source code in API documentation. The pre Java 18 version was using {@code ...} that had limitations.
- core-libs: Vector API (Third Incubator). Superior performance to equivalent scalar computations
- core-libs: Foreign Function & Memory API (Second Incubator). Interoperation with code and data outside of the Java runtime. Invoke functions outside JVM and memory not managed by the JVM, thus calling native libraries and process native data without JNI
- specification/language: Pattern Matching for switch (Second Preview)
1. selector expression typing (an integral primitive type or any reference type)
2. case null
3. type pattern (case Integer i -> )
4. guarded patterns (case String s && s.length() > 0 -> )
5. parentesized patterns (case Triangle t && (t.calculateArea() > 100) ->)
6. pattern labels dominance (String s included in CharSequence cs -> case)
7. pattern label completeness (missing cases for switch, compile error)
8. scope of the pattern variable (in case and block)
9. new label forms (case null: case String s:) (case null, String s ->)
10. total type (case Object o ->)
More details:
JEP 406
JEP 420
JEP 427
- hotspot/gc: The Z Garbage Collector now supports string deduplication. Each string object takes at least 24 bytes at minimum, has 2 fields value and hash and duplications are removed by replacing char[] only
- hotspot/gc: The Serial Garbage Collector now supports string deduplication
- hotspot/gc: The Parallel Garbage Collector now supports string deduplication
- tools/javac: Expand checks of javac's serial lint warning. Besides the traditional check of serialVersionUID in Serializable class, it has additional checks now.
- tools/javadoc(tool): Options to Include Script Files in Generated Documentation
- tools/javadoc(tool): @SuppressWarnings for DocLint Messages
- tools/javac: Passing Originating Elements From Filer to JavaFileManager
- core-libs/java.nio.charsets: Charset.forName() Taking fallback Default Value
- core-libs/java.util: New System Property to Control the Default Date Comment Written Out by java.util.Properties::store Methods
- core-libs/javax.annotation.processing: printError, printWarning, and printNote methods on Messager
- core-libs/javax.lang.model: Method to Get Outermost Type Element
- core-libs/javax.lang.model: Map from an Element to its JavaFileObject
- core-libs/javax.lang.model: Mapping between SourceVersion and Runtime.Version
- hotspot/compiler: Improve Compilation Replay. Compilation Replay is a JVM feature of debug builds that is mainly used to reproduce crashes in the C1 or C2 JIT compilers.
- hotspot/gc: Configurable Card Table Card Size
- hotspot/gc: Allow G1 Heap Regions up to 512MB
- hotspot/jfr: JDK Flight Recorder Event for Finalization
- security-libs: SunPKCS11 Provider Now Supports Some PKCS#11 v3.0 APIs
- security-libs/java.security: Alternate Subject.getSubject and doAs APIs Created That Do Not Depend on Security Manager APIs
- security-libs/java.security: KeyStore Has a getAttributes Method
- security-libs/java.security: Support for RSASSA-PSS in OCSP Response
- security-libs/java.security: New Option -version Added to keytool and jarsigner Commands
- security-libs/java.security: Migrate cacerts From JKS to Password-Less PKCS12
- security-libs/java.security: Allow Store Password to Be Null When Saving a PKCS12 KeyStore
- security-libs/javax.crypto:pkcs11: SunPKCS11 Provider Supports AES Cipher With KW and KWP Modes if Supported by PKCS11 Library
Removed Features and Options
- security-libs/java.security: Removal of IdenTrust Root Certificate
- security-libs/java.security: Removal of Google's GlobalSign Root Certificate
- client-libs/2d: Removal of Empty finalize() Methods in java.desktop Module
- core-libs/java.net: Removal of Support for Pre JDK 1.4 DatagramSocketImpl Implementations
- core-libs/java.net: Removal of impl.prefix JDK System Property Usage From InetAddress
- core-libs/java.net: Removal of Legacy PlainSocketImpl and PlainDatagramSocketImpl Implementations
- security-libs/org.ietf.jgss:krb5: Removal of default_checksum and safe_checksum_type From krb5.conf
Deprecated Features and Options, other notes and differences between Oracle JDK and OpenJDK not included