I am trying to build a project with JDK-12 ea. While trying to execute a sample class:
public static void main(String[] args) {
Scanner scanner = new Sc
The earliest version of IntelliJ that supports switch expressions is version 2019.1, which was released on March 27, 2019. You can get it here: https://www.jetbrains.com/idea/download . You also need JDK 12 of course, and set that as your project SDK.
Then you can set the language level to:
12 (Preview) - Switch expressions
With that, everything should work.
If it doesn't, you might want to check that You've;
Turning my comment into an answer. You can add the --enable-preview flag to the VM by going to:
Run -> Edit Configurations...
Then selecting your main class from the tree menu on the left, and pasting --enable-preview in the "VM options" box

You can do the same for the compiler by going to:
File -> Settings...
Then in the tree menu under Build, Execution, Deployment -> Compiler -> Java Compiler you can put --enable-preview in the "Additional command line parameters" box:

Note that intellisense still might not work after doing that. I'm still seeing red squiggly lines under the ->s with the error message "unexpected token". But, when I click the run button the class compiles and runs just fine.