1

Latest IntelliJ 2021.2.1 Community Edition doesn't let me compile sources of Java 12, that include switch expressions, with "Language Level 12", giving either:

switch expressions are not supported at language level '12' or Enhanced 'switch' blocks are not supported at language level '12'

I found this, mandating to set the language level to Java 12 Preview - Switch Expression, but it's not available in the latest IntelliJ.

Seriously? what am I supposed to do? set the language-level to 14? but I particularly want 12, and preview features must be available for 12.

What shall I do?

Giorgi Tsiklauri
  • 9,715
  • 8
  • 45
  • 66
  • 1
    Please see the discussion at https://youtrack.jetbrains.com/issue/IDEA-266128. Once a final JDK with these features is released, we no longer support a preview of it in the previous JDK versions. – CrazyCoder Sep 02 '21 at 15:55
  • @CrazyCoder super, super, super bad decision! just horrible one. And what if I want to demonstrate or reproduce something, with particularly Java 12 language? – Giorgi Tsiklauri Sep 02 '21 at 15:56
  • Use an older IntelliJ IDEA version from https://www.jetbrains.com/idea/download/previous.html. – CrazyCoder Sep 02 '21 at 15:59
  • ..and for which older version should I go to enable 12 preview features?.. what if I'm in Java 15, 16 or another preview features? how shall I then select which older versions of IntelliJ to download? shall I spent hours for matching the IntelliJ and Java versions? absolutely unpractical and bad decision. – Giorgi Tsiklauri Sep 02 '21 at 16:00
  • See https://www.jetbrains.com/help/idea/supported-java-versions.html. Switch expressions preview with Java 12 support is available in IntelliJ IDEA 2019.1. – CrazyCoder Sep 02 '21 at 16:01
  • Come one, please.. "Preview Features" are released very often! and if I, say, happen to be on the JDK 17, or even more - JDK 21, I should be keeping the track of which older versions of IntelliJ supported which particular Preview Features, which - not.. I should also ask to my students to bear 5 different versions of IDE and install all those on my machine as well.. just WHY? WHY on earth you've decided to go with this policy? was it taking too much to just keep the Language Syntax supported? to just keep one more option in the drop-down list? a truly, absolutely wrong and bad decision. – Giorgi Tsiklauri Sep 02 '21 at 16:08
  • We understand that it's not convenient, but at the moment there are no plans to support it. Sorry. – CrazyCoder Sep 02 '21 at 16:09

0 Answers0