Features

Preview Raw String Literals in IntelliJ IDEA 2018.3

Our drive to develop has taken us into the fast lane, and just look at us go! Even though Java 11 has just come out, we’re already adding initial support for Java 12 in our upcoming IntelliJ IDEA 2018.3!

Please note that Java 12 is not released yet. You must accept the terms of the legal notice of the beta Java specification to enable support for Java 12. The implementation of an early-draft specification developed under the Java Community Process (JCP) is made available for testing and evaluation purposes only and is not compatible with any specification of the JCP.

Raw string literals (JEP 326) are ready for you to preview in IntelliJ IDEA 2018.3 Beta. To take advantage of coding assistance for Java 12, set the language level to “12 (Preview) – Switch expression, raw string literals” in the Project Structure dialog.

You can also run your application on JDK 12, by simply setting the Project SDK to JDK 12.

image5

The IDE provides a quick-fix to convert multi-line string literals to raw string literals, and vice versa:

image6

If your code happens to have redundant leading or trailing backticks (`) around a value in the raw string literals, IntelliJ IDEA detects this and provides a corresponding quick-fix.

image3

We’ve extended the functionality that previously worked only for string literals, and now the IDE can also recognize regular expressions in raw string literals.
image2

Spell-checking works inside raw string literals as well.

image4

Now you can paste a string with line separators not only as a string literal, but also as a raw string literal. The quotes will be adjusted according to the content of the raw string literal.

image1

We’ve also extended the functionality of the intention that breaks a string literal and made it work for raw string literals too.

image7

Please note that even though JEP 326 is targeted at JDK 12, it is still a preview feature. This means that according to JEP 12, it is “fully specified and fully implemented, and yet impermanent.” If its implementation changes in an upcoming release of Java, we’ll make sure to reflect such a change in IntelliJ IDEA as well.

Try this brand new support for raw string literals in the upcoming IntelliJ IDEA 2018.3 and do give us your feedback! Please share your thoughts via the discussion forum, our issue tracker, or on Twitter!

Happy Developing!

image description