From 529ca0b29f822e0cceeaf9e1fb77431fb9aaf436 Mon Sep 17 00:00:00 2001 From: Jay Arthanareeswaran Date: Tue, 26 Sep 2023 09:44:03 +0530 Subject: [PATCH] Move left out tests to Java 21 and adjust the testcase as per spec (#1433) --- .../jdt/core/tests/model/JavaSearchBugs17Tests.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs17Tests.java b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs17Tests.java index 60c172fd01c..499aa716356 100644 --- a/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs17Tests.java +++ b/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/JavaSearchBugs17Tests.java @@ -1204,7 +1204,7 @@ public void testBug573943_029() throws Exception { // find all references on a class in switch pattern - without select public void testBug573943_030() throws Exception { try { - IJavaProject project = createJavaProject("first", new String[] {"src"}, new String[] {"JCL17_LIB"}, "bin", "17"); + IJavaProject project = createJavaProject("first", new String[] {"src"}, new String[] {"JCL17_LIB"}, "bin", "21"); project.setOption(JavaCore.COMPILER_PB_ENABLE_PREVIEW_FEATURES, JavaCore.DISABLED); project.open(null); createFolder("/first/src/p1"); @@ -1216,15 +1216,15 @@ public void testBug573943_030() throws Exception { createFile("/first/src/p1/X.java", "package p1;\n" + "public class X {\n" + - " public int field_j17; "+ + " public int field_j17;\n"+ "public static void main(String[] args) {\n" + "foo(Integer.valueOf(5));\n" + "foo(new Object());\n" + "}\n" + "private static void foo(Object o) {\n" + " switch (o) {\n" + - " case BClass i && field_j17>0 -> System.out.println(\"Integer:\" + i);\n" + - " default -> System.out.println(\"Object\" + o);\n" + + " case BClass i when field_j17 > 0 -> System.out.println(\"Integer:\" + i);\n" + + " default -> System.out.println(\"Object\" + o);\n" + " }\n" + "}\n" + "}\n" @@ -1413,7 +1413,7 @@ public void testBug575718_035() throws CoreException { "}\n" + "private static int foo(Object o) {\n" + " return switch (o) {\n" + - " case String strGP && (o instanceof String c3 && c3.length() > 0) -> 0;\n" + + " case String strGP when (o instanceof String c3 when c3.length() > 0) -> 0;\n" + " default -> 0;\n" + " };\n" + " }\n" +