Skip to content

Latest commit

 

History

History
44 lines (33 loc) · 1.78 KB

README.md

File metadata and controls

44 lines (33 loc) · 1.78 KB

Java 13

To run each example use: java --enable-preview --source 13 <FileName.java>

JEPs

  • 354 - Switch expression (preview 2)
  • 355 - Text blocks (preview)
  • 350 - Dynamic CDS Archives
  • 351 - ZGC: Uncommit Unused Memory
  • 353 - Reimplement the Legacy Socket API

Features

Language

  • Switch expressions improvements
    • Changed break from Java 12 to yield
  • Text blocks
    • flag to compile: -Xlint:text-blocks
  • API improvements
    • 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
  • Socket and ServerSocket reimplementation (alignment to Project Loom)

JVM

  • 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>
  • 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

Links