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 Scanner(System.in);
int value = scanner.nextInt();
// After JEP-325
switch (value) {
case 1 ->System.out.println("one");
case 2 ->System.out.println("two");
default ->System.out.println("many");
}
}
The IDE throws the error that reads
Error:java: error: invalid source release: 13
Relevant project configuration screens :
Module settings
SDKs
Compiler settings
IntelliJ IDEA 2018.3.3 (Community Edition) Build #IC-183.5153.38, built on January 9, 2019 JRE: 1.8.0_152-release-1343-b26 x86_64 JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o macOS 10.13.6
Tried switching back the language level to 12, without experimental features, but it ends in
I remember using the experimental features in recent past(not sure of exact IntelliJ version) successfully. Has something changed that I need to configure apart from this as well?
--enable-preview
for them... I am not aware of such a project level flag setting though. – Eastlakejava
and notjavac
! – Eastlakejavac
. If I select "12 (preview)" as a language level in the "Messages" I see on the last 2 lines "...Compilation completed with 1 error...", "Error:java: error: release version 12 not supported", and the error is the same as the one I get when using--release 12
with javac. intellij saying 'java' is talking about the used language I guess... Also, I'm not sure why you don't have "12 (preview)" as a language level, since you seem to have a newer version of intellij than me... – Luxor--enable-preview
flag. – Luxor--enable-preview
functionality which is what this question is based on. – Eastlake--enable-preview
in vm options or compiler, it is just your project need to set onlanguage level
and intellij will take care. Make sure not to selectx-Experimental
rather select speicific16 (preview) - Sealed types
– Infuscate