diff --git a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java index c9dfa9230cc..b6b56c65508 100644 --- a/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java +++ b/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/IncrementalTests.java @@ -1665,6 +1665,10 @@ public final class Child extends Parent { } public void testExhaustiveness() throws JavaModelException { + String javaVersion = System.getProperty("java.version"); + if (javaVersion != null && JavaCore.compareJavaVersions(javaVersion, "18") < 0) + return; + IPath projectPath = env.addProject("Project", "18"); env.addExternalJars(projectPath, Util.getJavaClassLibs()); diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest_17.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest_17.java index 559b3362dc2..2e53a56b59c 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest_17.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest_17.java @@ -156,7 +156,9 @@ boolean match(String err) { // Check behavior of expression switch in JDK18- // https://github.com/eclipse-jdt/eclipse.jdt.core/issues/3096#issuecomment-2417954288 public void testGHI1774_Expression() throws Exception { - + String javaVersion = System.getProperty("java.version"); + if (javaVersion != null && JavaCore.compareJavaVersions(javaVersion, "18") < 0) + return; String path = LIB_DIR; String libPath = null; if (path.endsWith(File.separator)) {