Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Java 28

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

JEPs

  • 401 - Value Objects (Preview)
  • 535 - Shenandoah GC: Generational Mode by Default
  • 539 - Strict Field Initialization in the JVM (Preview)
  • 540 - Simple JSON API (Incubator)
  • 541 - Deprecate the macOS/x64 Port for Removal
  • 542 - PEM Encodings of Cryptographic Objects

Features

  • Shenandoah GC: Generational Mode by Default
    • Shenandoah is a low-pause-time garbage collector
    • switch the default mode of Shenandoah GC to the generational mode
    • deprecate the non-generational mode
    • default mode: XX:+UseShenandoahGC -XX:ShenandoahGCMode=generational
    • to use non-generational mode: -XX:+UseShenandoahGC -XX:ShenandoahGCMode=satb
  • Simple JSON API
    • a simple standard API for parsing and generating JSON documents that conform to RFC 8259
    • this JEP replaces the JEP 198 - Light-Weight JSON API
    • the API is organized around the sealed interface JsonValue which has the following sub-interfaces: JsonString, JsonNumber, JsonBoolean, JsonNull, JsonObject and JsonArray
    • the Json.parse method returns a tree of JsonValue instances that expose the names, types, and values of the parsed JSON data
    • generating JSON text:
    • navigating JSON documents:
      • JsonValue methods to read a value:
        • get(String): obtains the value of an object member
        • get(int): obtains an array element
        • tryGet(String): obtains an optional value of an object member
      • it is recommended to use type patterns to handle dynamic structure
      • if the JsonValue instance is of the wrong type or the requested member or element does not exist a JsonValueException will be thrown
    • converting values to Java types:
      • JsonValue methods to convert a value:
        • asString
        • asInt
        • asLong()
        • asDouble()
        • asBoolean()
        • asMap()
        • asList()
      • the methods are implemented by the JsonValue sub-interfaces (JsonString, JsonNumber)
      • there is no conversion method for null value, we should check with instanceof JsonNull or use tryValue that returns an Optional
      • if a JsonValue is not an instance of the appropriate subtype for a conversion method then the method throws a JsonValueException
      • numeric conversions can fail for reasons such as the numeric value not being representable in the target Java numeric type, which also causes a JsonValueException to be thrown
  • PEM Encodings of Cryptographic Objects
    • promotion to standard
    • "introduce an API for encoding objects that represent cryptographic keys, certificates, and certificate revocation lists into the widely-used Privacy-Enhanced Mail (PEM) transport format"
    • support conversions between PEM text and cryptographic objects that have standard representations in the binary formats of PKCS#8 (for private keys), X.509 (public keys, certificates, and certificate revocation lists), and PKCS#8 v2.0 (encrypted private keys and asymmetric keys)

Links