To run each example use: java --enable-preview --source 13 <FileName.java>
- 354 - Switch expression (preview 2)
- 355 - Text blocks (preview)
- 350 - Dynamic CDS Archives
- 351 - ZGC: Uncommit Unused Memory
- 353 - Reimplement the Legacy Socket API
- Switch Expressions (second preview)
- Changed
break
from Java 12 toyield
- Changed
- Text Blocks (preview)
- flag to compile:
-Xlint:text-blocks
- flag to compile:
- Reimplement Legacy Socket API
Socket
andServerSocket
reimplementation (alignment to Project Loom)
- String methods:
stripIdent
: same operation done by the compiler to strip incidental identation from text block';translateEscapes
: same operation done by the compiler to translate escapes in strings;formatted
: shortcut to String.format '"%s years old".formatted(42)
)
- NIO improvements
- Creating Class-Data archives For AppCDS
- flag to java
-XX:ArchiveClassesAtExit=<FileHere.jsa>
to generate class-data on exit - run with it:
-XX:SharedArchiveFile=<FileHere.jsa>
- flag to java
- ZGC (Oracle's Z GC) returns unused memory to SO
-XX:ZUncommitDelay=<seconds>
to set the delay in seconds-XX:SoftMaxHeapSize
: soft (won't generate OutOfMemoryError - will request more) limit to avoid the JVM to grow in memory