From a569f00998024f2da779722541c6c0d549aeb780 Mon Sep 17 00:00:00 2001 From: Srikanth Sankaran <131454720+srikanth-sankaran@users.noreply.github.com> Date: Sat, 19 Oct 2024 21:24:37 +0530 Subject: [PATCH] Fix test failures in I build. (#3120) * Fixes https://github.com/eclipse-jdt/eclipse.jdt.core/issues/3118 --- .../org/eclipse/jdt/core/tests/builder/IncrementalTests.java | 4 ++++ .../core/tests/compiler/regression/BatchCompilerTest_17.java | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) 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)) {