GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — java-new-features/java-13 at master · jhavierc/java-new-features

Expand file tree

/

java-13

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
 
 
/

java-13

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
README.md
README.md
 
 
SwitchExpressionTests.java
SwitchExpressionTests.java
 
 
TextBlocksExample.java
TextBlocksExample.java
 
 

README.md

Outline

Java 13

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

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

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

Warnings

  • Tools
    • Maven: 3.5.0
      • compiler plugin: 3.8.0
      • surefire and failsafe: 2.22.0
      • plugins using ASM (e.g. the shade plugin) will likely need to be updated as well
<plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <configuration>
        <release>13</release>
        <compilerArgs>
            --enable-preview
        </compilerArgs>
    </configuration>
</plugin>
<plugin>
    <artifactId>maven-surefire-plugin</artifactId>
    <configuration>
        <argLine>--enable-preview</argLine>
    </configuration>
</plugin>
<plugin>
    <artifactId>maven-failsafe-plugin</artifactId>
    <configuration>
        <argLine>--enable-preview</argLine>
    </configuration>
</plugin>

Links

  • Java 13 Documentation
  • Java 13 Guide
  • Switch Expression
  • Text Block Guid
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.