Even though Java Development Kit (JDK) 11 arrived last month, work proceeds on its successor, JDK 12, with one set of enhancements, one functional removal, and two experimental (beta) capabilities proposed so far for the release, expected on March 19, 2019.
JDK 12 is now in development in the OpenJDK community.
As Java builders move to support pattern matching, existing irregularities of the existing
switch statement become impediments. These include the default control flow behavior of switch blocks; default scoping of switch blocks, in which the block is treated as one single scope; and switch working only as a statement. The current design of Java’s
switch statement follows closely languages such as C++ and, by default, supports fallthrough semantics. This control flow has been useful for writing low-level code. But as switch is used in higher-level contexts, its error-prone nature begins to outweigh flexibility.
Raw string literals
The beta raw string literals would span multiple lines of source code while not interpreting escape sequences, such as
n, or Unicode escapes, of the form
/uXXX. Java’s builders have multiple goals for this capability, including:
- Making it easier to express a sequence of characters in a readable form, without Java Simplification in supplying strings targeted for grammars other than Java.
- Supplying strings that span several lines of source code without having special indicators for new lines.
- The ability to express the same strings as traditional string literals, except for platform-specific line terminators.
- Library support to replicate the current javacstring-literal interpretation of escapes and manage left-margin trimming.