From 35748b7942d96db67714b50055b7a855184a353b Mon Sep 17 00:00:00 2001 From: Jay Arthanareeswaran Date: Fri, 24 Feb 2023 15:30:54 +0530 Subject: [PATCH] [20][record pattern][test] RecordPatternTests - test25 and test28 failure with javac #786 --- .../regression/AbstractRegressionTest.java | 3 +++ .../regression/RecordPatternTest.java | 19 +++++++------------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java index 05638fa6535..6934f117aa0 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java @@ -2534,6 +2534,9 @@ protected void runJavac( if (newOptions.indexOf(" -implicit") < 0) { newOptions = newOptions.concat(" -implicit:none"); } + if (classLibraries == null) { + classLibraries = this.classpaths; + } if (classLibraries != null) { List filteredLibs = new ArrayList<>(); for (String lib : classLibraries) { diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordPatternTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordPatternTest.java index 14626ae22b0..669ba2611db 100644 --- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordPatternTest.java +++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordPatternTest.java @@ -776,7 +776,10 @@ public void test22() { "two\n" + "Returns: 0\n" + "one\n" + - "Returns: 5"); + "Returns: 5", + getCompilerOptions(true), + new String[] {"--enable-preview"}, + JavacTestOptions.SKIP); // Javac crashes. Let's skip for no } // Nested record pattern with a method invocation in a 'when' clause public void test23 () { @@ -898,7 +901,6 @@ public void test25() { this.extraLibPath, JavaCore.VERSION_20, true); - // new String[] {libPath} this.runConformTest( new String[] { "p/X.java", @@ -922,11 +924,9 @@ public void test25() { + "}\n" }, "1", - null, - true, + getCompilerOptions(true), new String[] {"--enable-preview"}, - null, - null); + JavacTestOptions.SKIP); // Too complicated to pass extra lib to Javac, let's skip } catch (IOException e) { System.err.println("RecordPatternTest.test25() could not write to current working directory " + currentWorkingDirectoryPath); } finally { @@ -1058,12 +1058,7 @@ public void test28() { + "record ColoredPoint(Point p, Color c) {}\n" + "record Rectangle(ColoredPoint upperLeft, ColoredPoint lowerRight) {}" }, - "5", - null, - true, - new String[] {"--enable-preview"}, - null, - null); + "5"); } // Test that a simple type pattern dominates a following record pattern of the same type public void test29() {