The JDK Enhancement Proposals (JEP) team is proposing they drop raw string literals from version 12 of the Java programming language.
According to the JEP, “a raw string literal can span multiple lines of source code and does not interpret escape sequences, such as \n, or Unicode escapes, of the form \uXXXX.” The goal for adding this into the programming language was to make it easier for developers to express sequences of characters, supply strings targeted for grammars and supply strings that span several lines of source. However, at this time some team members don’t have high confidence in the feature and therefore are hesitant to make it a permanent part of the language.
RELATED CONTENT: Making Java a modern language
“We think letting it preview in its current state would be to the detriment of the language. We’re of course disappointed that this means it will take slightly longer for this feature to make it into the language, but we think that’s the best choice,” Brian Goetz, Java language architect for Oracle, wrote in an email. “While we can expect that for any language feature, there will be a
nontrivial volume of ‘I would have preferred it differently’ feedback, in reviewing the feedback we have received, I am no longer convinced that we’ve yet got to the right set of tradeoffs between complexity and expressiveness, or that we’ve explored enough of the design space to be confident that the current design is the best we can do. By withdrawing, we can continue to refine the design, explore more options, and aim for a preview that actually meets the requirements of the Preview Feature process (JEP 12).”
Some of the feedback the proposal has gotten included: the two-backquote sequence could be confused for an empty string; no direct way to start or end a raw string literal with backquote; and unnecessary asymmetry between raw string literals and traditional string literals.
“We think we can do better on some or many of these fronts. One of the benefits of the newer more rapid cadence is that the cost of missing a train (even one that you have already boarded, but which has not yet left the station) is much lower. And, assuming that it is unlikely that we’d exit Preview unchanged, withdrawing now does not change the likely date at which this feature becomes permanent, as we’d likely want to re-Preview a modified version anyway,” Goetz wrote.