Support for Java 13 Preview Features in IntelliJ IDEA 2019.2

Java 13 is planned for release on September 17, 2019. And IntelliJ IDEA is already getting ready for it! Starting with version 2019.2, IntelliJ IDEA has support for Java 13 Preview features.

Support for Switch Expressions preview feature

As you may already know, the Java 12 preview significantly improved the handling of the traditional switch statement. Java 13 offers a second preview of switch expressions to drop the “break with value” statement in favor of “yield” (JEP 354).

Here is an example of yielding the values from a switch expression:

import java.time.DayOfWeek;

class Sample {

    private int workWeekDays(DayOfWeek s) {
        return switch (s) {
            case MONDAY:
                yield 1;
            case TUESDAY:
                yield 2;
            case WEDNESDAY:
                yield 3;
            case THURSDAY:
                yield 4;
            case FRIDAY:
                System.out.println("Seems that the selected day is weekend");
                yield 0;


A switch expression must either complete normally with a value or complete abruptly by throwing an exception. In the cases where you miss yielding a value, IntelliJ IDEA will underline the “switch” keyword and throw an error message indicating that the result is not produced in all execution paths.


Support for Text Blocks preview feature

One more preview feature targeting JDK 13 is text blocks (JEP 355). A text block is a new way to embed a multiline snippet into the Java source code. It enhances readability and gives the developer control over the format.

Let’s take a closer look at text blocks. Up to now a snippet of HTML, XML, SQL, etc. code embedded in a string literal was hard-to-read, not easily editable, and error-prone. The new “two-dimensional” text blocks syntax allows writing the same lines of code without any cumbersome or excessive complexity.
IntelliJ IDEA now understands the syntax of preview text blocks and provides correct highlighting for it.


IntelliJ IDEA 2019.2 supports most of the features applicable to normal string literals also for text blocks, though it’s a work in progress and more goodies can be expected. Now you can, for example, try the ‘Join concatenated String literal’ quick-fix or check the constant value of the concatenation.


The IDE will correctly highlight the code with skipped line terminator between opening and closing delimiters ( “”” ), giving an error message that the new line is missing after an opening quote.


As you may know, working with string literals can be made simpler with IntelliJ IDEA’s language injection features. They provide comprehensive language assistance while you edit the fragments of injected code.

For more details please refer to https://www.jetbrains.com/help/idea/using-language-injections.html

How to enable support for Java 13 preview features
To enable this support, set the corresponding Language Level in the Project Structure settings and install the JDK to compile.
At the time this blog-post is written, Java 13 is still not released, so only early access builds are available and their stability, quality, and security are not guaranteed.
JDK 13 Early-Access Builds are available through this link: https://jdk.java.net/13.

IntelliJ IDEA policy of supporting Java preview versions
IntelliJ IDEA is committed to supporting the preview features from the latest Java release and, if possible, the preview features of whatever release is coming next. So v2019.2 will support Java 12 and 13 preview features. Please note that v2019.3 will drop the support for Java 12 preview features as IntelliJ IDEA 2019.3 will be released after the release of Java 13.

Your feedback on the new IntelliJ IDEA features is always welcome!

Happy Developing!

Comments below can no longer be edited.

9 Responses to Support for Java 13 Preview Features in IntelliJ IDEA 2019.2

  1. Avatar

    dev dev says:

    August 7, 2019

    Disappointed, Latest IntelliJ IDEA 2019.2 eats a lot of RAM !
    From -Xmx750m to -Xmx2038m, really ?

    • Avatar

      Olga Klisho says:

      August 7, 2019

      Please create an issue at YouTrack (https://youtrack.jetbrains.com/issues) describing when IntelliJ IDEA consumes much RAM. Thank you.

    • Avatar

      Tagir Valeev says:

      August 28, 2019

      It’s just a default setting change. It’s not that IDEA became more hungry. We just concluded that it’s more appropriate to the majority of the users. You are completely free to set it back to -Xmx750m if it was comfortable for you in the previous release.

  2. Avatar

    Venkat says:

    August 21, 2019

    Unable to update to 2019.2 because of the following error:

    29/07 10:05:55 INFO CreateAction.doApply – Create action. File: C:\Program Files\JetBrains\IntelliJ IDEA Community Edition 2018.1.6\jbr\legal\java.xml.crypto
    29/07 10:05:55 INFO Utils.getZipEntry – entryPath: jbr/legal/java.xml.crypto/
    29/07 10:05:55 ERROR Patch.apply – apply failed
    java.io.IOException: Unable to create directory jbr/legal/java.xml.crypto/
    at com.intellij.updater.CreateAction.doApply(CreateAction.java:76)
    at com.intellij.updater.PatchAction.apply(PatchAction.java:195)
    at com.intellij.updater.Patch.lambda$apply$3(Patch.java:342)
    at com.intellij.updater.Patch.forEach(Patch.java:426)
    at com.intellij.updater.Patch.apply(Patch.java:333)
    at com.intellij.updater.PatchFileCreator.apply(PatchFileCreator.java:64)
    at com.intellij.updater.Runner.install(Runner.java:326)
    at com.intellij.updater.Runner.main(Runner.java:118)

    System Specifications:
    16 GB RAM

  3. Avatar

    Marcos Rossini says:

    August 23, 2019

    What if this is a maven project? I am running with Java 14-loom Early-Aaccess and I am trying to use Source Level as 13 Preview, but I found no configuration in my pom.xml that intellij would correctly define my module settings, It always sets it to Source Level 13 No New language features.

    Here is compile plugin conf:



    Note that running mvn verify on command line works perfectly.

    • Avatar

      Tagir Valeev says:

      August 28, 2019

      Hello! We are sorry for the inconvenience. It seems that your problem is addressed in IDEA-212618. If so then I have good news for you: it was fixed and should be delivered in the next update 2019.2.2.

  4. Avatar

    Ayb says:

    November 21, 2019

    Installed jdk 13. Getting this error with a var declaration:

    Warning:(3, 13) java: as of release 10, ‘var’ is a restricted local variable type and cannot be used for type declarations or as the element type of an array
    Error:(3, 9) java: cannot find symbol
    symbol: class var
    location: class Main13

    javac on the command line works OK. Here is the code:

    public static void main(String[] args) {
    var x = 10;

    The SDK is set to JDK 13, and the compiler level to 11 (that is the highest available choice).

    • Avatar

      olgakli says:

      November 22, 2019

      Please clarify what JDK build do you use when compilation fails? What javac do you use for compilation in this case:
      > javac on the command line works OK

Discover more