mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
[java] IDEA-374214 Support JEP 507: Primitive Types in Patterns, instanceof, and switch (Third Preview)
- there aren't changes, just new tests for java 25 and java 25 preview GitOrigin-RevId: 1d73ea675b90c8e3380152ecbad6853431400e2d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
c39c6768e7
commit
83d8559c09
@@ -119,6 +119,7 @@ enum class JavaFeature {
|
||||
//jep 463,477
|
||||
INHERITED_STATIC_MAIN_METHOD(LanguageLevel.JDK_22_PREVIEW, "feature.inherited.static.main.method"),
|
||||
IMPLICIT_IMPORT_IN_IMPLICIT_CLASSES(LanguageLevel.JDK_23_PREVIEW, "feature.implicit.import.in.implicit.classes"),
|
||||
//JEP 507
|
||||
PRIMITIVE_TYPES_IN_PATTERNS(LanguageLevel.JDK_23_PREVIEW, "feature.primitive.types.in.patterns"),
|
||||
|
||||
//see together with PACKAGE_IMPORTS_SHADOW_MODULE_IMPORTS and TRANSITIVE_DEPENDENCY_ON_JAVA_BASE
|
||||
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package test.something;
|
||||
|
||||
public class SwitchRecordPrimitiveJava25 {
|
||||
static void main(String[] args) {
|
||||
Integer a = 1;
|
||||
switch (a) {
|
||||
case <error descr="Primitive types in patterns, instanceof and switch are not supported at language level '25'">int _</error> -> System.out.println("1");
|
||||
default -> throw new IllegalStateException("Unexpected value: " + a);
|
||||
}
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package test.something;
|
||||
|
||||
public class SwitchRecordPrimitiveJava25Preview {
|
||||
static void main(String[] args) {
|
||||
Integer a = 1;
|
||||
switch (a) {
|
||||
case int _ -> System.out.println("1");
|
||||
default -> throw new IllegalStateException("Unexpected value: " + a);
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
@@ -2,6 +2,8 @@
|
||||
package com.intellij.java.codeInsight.daemon;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -48,4 +50,12 @@ public class LightPrimitivePatternsHighlightingTest extends LightJavaCodeInsight
|
||||
myFixture.configureByFile(getTestName(false) + ".java");
|
||||
myFixture.checkHighlighting();
|
||||
}
|
||||
|
||||
public void testSwitchRecordPrimitiveJava25Preview() {
|
||||
IdeaTestUtil.withLevel(getModule(), LanguageLevel.JDK_25_PREVIEW, this::doTest);
|
||||
}
|
||||
|
||||
public void testSwitchRecordPrimitiveJava25() {
|
||||
IdeaTestUtil.withLevel(getModule(), LanguageLevel.JDK_25, this::doTest);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user