created on | July 16, 2022 |
general availability on 2019-09-17
jep | state | summary /remark |
---|---|---|
jep 351: zgc, uncommit unused memory (Experimental) | experimental | zgc does not currently uncommit and return memory to the operating system, even when that memory has been unused for a long time. enhance zgc to return unused heap memory to the operating system. |
jep 354: switch expressions (Second Preview) | second preview | extended switch statement that can be used as either a statement or an expression. both forms can use either a “traditional” or “simplified” scoping and control flow behavior. see comments on ‘JEP 325: Switch Expressions (Preview)' |
jep 355: text blocks (Preview) | preview | add text blocks to the java language. a text block is a multi-line string literal that avoids the need for most escape sequences, automatically formats the string in a predictable way, and gives the developer control over format when desired. |
jep | summary /remark |
---|---|
jep 350: dynamic cds archives | extend application class-data sharing to allow the dynamic archiving of classes at the end of java application execution. the archived classes will include all loaded application classes and library classes that are not present in the default, base-layer cds archive. |
jep 353: reimplement the legacy socket api | replace the underlying implementation used by the java.net.socket and java.net.serversocket apis with a simpler and more modern implementation that is easy to maintain and debug. |
none
none
seems that nothing changed here in comparison to jep 325: switch expressions (preview)
For an intro of this feature, I quote from the description of JEP 355:
" a text block is a new kind of literal in the java language. it may be used to denote a string anywhere that a string literal could appear, but offers greater expressiveness and less accidental complexity.
the opening delimiter is a sequence of three double quote characters (""") followed by zero or more white spaces followed by a line terminator. the content begins at the first character after the line terminator of the opening delimiter.
the closing delimiter is a sequence of three double quote characters. the content ends at the last character before the first double quote of the closing delimiter.
the content may include double quote characters directly, unlike the characters in a string literal. the use of \" in a text block is permitted, but not necessary or recommended. fat delimiters (""") were chosen so that " characters could appear unescaped, and also to visually distinguish a text block from a string literal.
the content may include line terminators directly, unlike the characters in a string literal. the use of \n in a text block is permitted, but not necessary or recommended. "
jep 355: text blocks (preview), description
example of a text block:
this equivalent to:
and equivalent to the concatenated form:
if a line terminator is not required at the end of the string, then the closing delimiter can be placed on the last line of content:
text blocks are processed in three steps:
incidental white space is:
those two forms of whitespace are very unlikely meant by the developer to end up in the text block.
essential white space is white space that belongs to the content of the literal in the text block code.
for a description how the compile-time process distinguishes between incidental and essential white space, I quote from the JEP 355, compile-time processing:
" the re-indentation algorithm takes the content of a text block whose line terminators have been normalized to lf. it removes the same amount of white space from each line of content until at least one of the lines has a non-white space character in the leftmost position. the position of the opening """ characters has no effect on the algorithm, but the position of the closing """ characters does have an effect if placed on its own line. "
jep 355: text blocks (preview), compile-time processing
so the first example.
defines the text block:
whereas with (note the indentation of the text relative to the closing delimiter):
we get the following text block:
openjdk JDK 13 feature list and schedule
JEP 354: Switch Expressions (Second Preview)
JEP 355: Text Blocks (Preview)