Stop running type switch tests on old jdks
- The tests were just checking for invalid class file version
for the testJVM and were disabled on R8
Change-Id: I86753804780b3f2eb9694c03339cdbf588feab2f
diff --git a/src/test/examplesJava21/switchpatternmatching/EnumLessCasesAtRuntimeSwitchTest.java b/src/test/examplesJava21/switchpatternmatching/EnumLessCasesAtRuntimeSwitchTest.java
index 63c6d26..50baa2e 100644
--- a/src/test/examplesJava21/switchpatternmatching/EnumLessCasesAtRuntimeSwitchTest.java
+++ b/src/test/examplesJava21/switchpatternmatching/EnumLessCasesAtRuntimeSwitchTest.java
@@ -17,7 +17,6 @@
import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.utils.StringUtils;
import com.android.tools.r8.utils.codeinspector.CodeInspector;
-import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -33,7 +32,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withCfRuntimesStartingFromIncluding(CfVm.JDK21)
+ .withDexRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .build();
}
public static String EXPECTED_OUTPUT =
@@ -52,10 +55,7 @@
testForJvm(parameters)
.apply(this::addModifiedProgramClasses)
.run(parameters.getRuntime(), Main.class)
- .applyIf(
- parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK21),
- r -> r.assertSuccessWithOutput(EXPECTED_OUTPUT),
- r -> r.assertFailureWithErrorThatThrows(UnsupportedClassVersionError.class));
+ .assertSuccessWithOutput(EXPECTED_OUTPUT);
}
private <T extends TestBuilder<?, T>> void addModifiedProgramClasses(
@@ -87,10 +87,6 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
- Assume.assumeTrue(
- parameters.isDexRuntime()
- || (parameters.isCfRuntime()
- && parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK21)));
testForR8(parameters.getBackend())
.apply(this::addModifiedProgramClasses)
.applyIf(
diff --git a/src/test/examplesJava21/switchpatternmatching/EnumMoreCasesAtRuntimeSwitchTest.java b/src/test/examplesJava21/switchpatternmatching/EnumMoreCasesAtRuntimeSwitchTest.java
index 575ebfd..493d588 100644
--- a/src/test/examplesJava21/switchpatternmatching/EnumMoreCasesAtRuntimeSwitchTest.java
+++ b/src/test/examplesJava21/switchpatternmatching/EnumMoreCasesAtRuntimeSwitchTest.java
@@ -19,7 +19,6 @@
import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.utils.StringUtils;
import com.android.tools.r8.utils.codeinspector.CodeInspector;
-import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -35,7 +34,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withCfRuntimesStartingFromIncluding(CfVm.JDK21)
+ .withDexRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .build();
}
public static String EXPECTED_OUTPUT =
@@ -87,12 +90,8 @@
testForJvm(parameters)
.apply(this::addModifiedProgramClasses)
.run(parameters.getRuntime(), Main.class)
- .applyIf(
- parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK21),
- r ->
- r.assertSuccessWithOutput(
- String.format(EXPECTED_OUTPUT, matchException(), matchException())),
- r -> r.assertFailureWithErrorThatThrows(UnsupportedClassVersionError.class));
+ .assertSuccessWithOutput(
+ String.format(EXPECTED_OUTPUT, matchException(), matchException()));
}
private <T extends TestBuilder<?, T>> void addModifiedProgramClasses(
@@ -138,10 +137,6 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
- Assume.assumeTrue(
- parameters.isDexRuntime()
- || (parameters.isCfRuntime()
- && parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK21)));
testForR8(parameters.getBackend())
.apply(this::addModifiedProgramClasses)
.applyIf(
diff --git a/src/test/examplesJava21/switchpatternmatching/EnumSwitchTest.java b/src/test/examplesJava21/switchpatternmatching/EnumSwitchTest.java
index 5b1f9fb..bd328bf 100644
--- a/src/test/examplesJava21/switchpatternmatching/EnumSwitchTest.java
+++ b/src/test/examplesJava21/switchpatternmatching/EnumSwitchTest.java
@@ -18,7 +18,6 @@
import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.utils.StringUtils;
import com.android.tools.r8.utils.codeinspector.CodeInspector;
-import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -34,7 +33,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withCfRuntimesStartingFromIncluding(CfVm.JDK21)
+ .withDexRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .build();
}
public static String EXPECTED_OUTPUT =
@@ -51,10 +54,7 @@
testForJvm(parameters)
.apply(this::addModifiedProgramClasses)
.run(parameters.getRuntime(), Main.class)
- .applyIf(
- parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK21),
- r -> r.assertSuccessWithOutput(String.format(EXPECTED_OUTPUT, matchException())),
- r -> r.assertFailureWithErrorThatThrows(UnsupportedClassVersionError.class));
+ .assertSuccessWithOutput(String.format(EXPECTED_OUTPUT, matchException()));
}
private <T extends TestBuilder<?, T>> void addModifiedProgramClasses(
@@ -99,10 +99,6 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
- Assume.assumeTrue(
- parameters.isDexRuntime()
- || (parameters.isCfRuntime()
- && parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK21)));
testForR8(parameters.getBackend())
.apply(this::addModifiedProgramClasses)
.applyIf(
diff --git a/src/test/examplesJava21/switchpatternmatching/EnumSwitchUsingEnumSwitchBootstrapMethodTest.java b/src/test/examplesJava21/switchpatternmatching/EnumSwitchUsingEnumSwitchBootstrapMethodTest.java
index 3b9fe1b..605fd80 100644
--- a/src/test/examplesJava21/switchpatternmatching/EnumSwitchUsingEnumSwitchBootstrapMethodTest.java
+++ b/src/test/examplesJava21/switchpatternmatching/EnumSwitchUsingEnumSwitchBootstrapMethodTest.java
@@ -15,7 +15,6 @@
import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.utils.StringUtils;
import com.android.tools.r8.utils.codeinspector.CodeInspector;
-import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -31,7 +30,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withCfRuntimesStartingFromIncluding(CfVm.JDK21)
+ .withDexRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .build();
}
public static String EXPECTED_OUTPUT =
@@ -65,10 +68,7 @@
testForJvm(parameters)
.addInnerClassesAndStrippedOuter(getClass())
.run(parameters.getRuntime(), Main.class)
- .applyIf(
- parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK21),
- r -> r.assertSuccessWithOutput(EXPECTED_OUTPUT),
- r -> r.assertFailureWithErrorThatThrows(UnsupportedClassVersionError.class));
+ .assertSuccessWithOutput(EXPECTED_OUTPUT);
}
@Test
@@ -84,10 +84,6 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
- Assume.assumeTrue(
- parameters.isDexRuntime()
- || (parameters.isCfRuntime()
- && parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK21)));
testForR8(parameters.getBackend())
.addInnerClassesAndStrippedOuter(getClass())
.applyIf(
diff --git a/src/test/examplesJava21/switchpatternmatching/StringSwitchTest.java b/src/test/examplesJava21/switchpatternmatching/StringSwitchTest.java
index 150951a..3298ab2 100644
--- a/src/test/examplesJava21/switchpatternmatching/StringSwitchTest.java
+++ b/src/test/examplesJava21/switchpatternmatching/StringSwitchTest.java
@@ -15,7 +15,6 @@
import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.utils.StringUtils;
import com.android.tools.r8.utils.codeinspector.CodeInspector;
-import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -31,7 +30,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withCfRuntimesStartingFromIncluding(CfVm.JDK21)
+ .withDexRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .build();
}
public static String EXPECTED_OUTPUT =
@@ -50,10 +53,7 @@
testForJvm(parameters)
.addInnerClassesAndStrippedOuter(getClass())
.run(parameters.getRuntime(), Main.class)
- .applyIf(
- parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK21),
- r -> r.assertSuccessWithOutput(EXPECTED_OUTPUT),
- r -> r.assertFailureWithErrorThatThrows(UnsupportedClassVersionError.class));
+ .assertSuccessWithOutput(EXPECTED_OUTPUT);
}
@Test
@@ -68,10 +68,6 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
- Assume.assumeTrue(
- parameters.isDexRuntime()
- || (parameters.isCfRuntime()
- && parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK21)));
testForR8(parameters.getBackend())
.addInnerClassesAndStrippedOuter(getClass())
.applyIf(
diff --git a/src/test/examplesJava21/switchpatternmatching/TypeSwitchMissingClassTest.java b/src/test/examplesJava21/switchpatternmatching/TypeSwitchMissingClassTest.java
index c037f90..995abab 100644
--- a/src/test/examplesJava21/switchpatternmatching/TypeSwitchMissingClassTest.java
+++ b/src/test/examplesJava21/switchpatternmatching/TypeSwitchMissingClassTest.java
@@ -17,7 +17,6 @@
import com.android.tools.r8.utils.StringUtils;
import com.android.tools.r8.utils.codeinspector.CodeInspector;
import java.util.List;
-import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -38,7 +37,11 @@
@Parameters(name = "{0}, {1}")
public static List<Object[]> data() {
return buildParameters(
- getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build(),
+ getTestParameters()
+ .withCfRuntimesStartingFromIncluding(CfVm.JDK21)
+ .withDexRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .build(),
List.of(new ClassHolder(C.class), new ClassHolder(Color.class)));
}
@@ -70,10 +73,7 @@
testForJvm(parameters)
.apply(this::addModifiedProgramClasses)
.run(parameters.getRuntime(), Main.class)
- .applyIf(
- parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK21),
- this::assertResult,
- r -> r.assertFailureWithErrorThatThrows(UnsupportedClassVersionError.class));
+ .apply(this::assertResult);
}
private void assertResult(TestRunResult<?> r) {
@@ -103,10 +103,6 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
- Assume.assumeTrue(
- parameters.isDexRuntime()
- || (parameters.isCfRuntime()
- && parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK21)));
testForR8(parameters.getBackend())
.apply(this::addModifiedProgramClasses)
.applyIf(
diff --git a/src/test/examplesJava21/switchpatternmatching/TypeSwitchTest.java b/src/test/examplesJava21/switchpatternmatching/TypeSwitchTest.java
index 83a428f..d4c2bfe 100644
--- a/src/test/examplesJava21/switchpatternmatching/TypeSwitchTest.java
+++ b/src/test/examplesJava21/switchpatternmatching/TypeSwitchTest.java
@@ -15,7 +15,6 @@
import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.utils.StringUtils;
import com.android.tools.r8.utils.codeinspector.CodeInspector;
-import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -31,7 +30,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withCfRuntimesStartingFromIncluding(CfVm.JDK21)
+ .withDexRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .build();
}
public static String EXPECTED_OUTPUT =
@@ -49,10 +52,7 @@
testForJvm(parameters)
.addInnerClassesAndStrippedOuter(getClass())
.run(parameters.getRuntime(), Main.class)
- .applyIf(
- parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK21),
- r -> r.assertSuccessWithOutput(EXPECTED_OUTPUT),
- r -> r.assertFailureWithErrorThatThrows(UnsupportedClassVersionError.class));
+ .assertSuccessWithOutput(EXPECTED_OUTPUT);
}
@Test
@@ -71,10 +71,6 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
- Assume.assumeTrue(
- parameters.isDexRuntime()
- || (parameters.isCfRuntime()
- && parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK21)));
testForR8(parameters.getBackend())
.addInnerClassesAndStrippedOuter(getClass())
.applyIf(
diff --git a/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/EnumLessCasesAtRuntimeSwitchTest.java b/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/EnumLessCasesAtRuntimeSwitchTest.java
index 3625fe1..b87d40f 100644
--- a/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/EnumLessCasesAtRuntimeSwitchTest.java
+++ b/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/EnumLessCasesAtRuntimeSwitchTest.java
@@ -17,7 +17,6 @@
import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.utils.StringUtils;
import com.android.tools.r8.utils.codeinspector.CodeInspector;
-import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -34,7 +33,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withCfRuntimesStartingFromIncluding(CfVm.JDK23)
+ .withDexRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .build();
}
public static String EXPECTED_OUTPUT =
@@ -53,10 +56,7 @@
testForJvm(parameters)
.apply(this::addModifiedProgramClasses)
.run(parameters.getRuntime(), Main.class)
- .applyIf(
- parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK23),
- r -> r.assertSuccessWithOutput(EXPECTED_OUTPUT),
- r -> r.assertFailureWithErrorThatThrows(UnsupportedClassVersionError.class));
+ .assertSuccessWithOutput(EXPECTED_OUTPUT);
}
private <T extends TestBuilder<?, T>> void addModifiedProgramClasses(
@@ -88,10 +88,6 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
- Assume.assumeTrue(
- parameters.isDexRuntime()
- || (parameters.isCfRuntime()
- && parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK23)));
testForR8(parameters.getBackend())
.apply(this::addModifiedProgramClasses)
.applyIf(
diff --git a/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/EnumMoreCasesAtRuntimeSwitchTest.java b/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/EnumMoreCasesAtRuntimeSwitchTest.java
index 51d0386..83af928 100644
--- a/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/EnumMoreCasesAtRuntimeSwitchTest.java
+++ b/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/EnumMoreCasesAtRuntimeSwitchTest.java
@@ -19,7 +19,6 @@
import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.utils.StringUtils;
import com.android.tools.r8.utils.codeinspector.CodeInspector;
-import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -36,7 +35,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withCfRuntimesStartingFromIncluding(CfVm.JDK23)
+ .withDexRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .build();
}
public static String EXPECTED_OUTPUT =
@@ -88,12 +91,8 @@
testForJvm(parameters)
.apply(this::addModifiedProgramClasses)
.run(parameters.getRuntime(), Main.class)
- .applyIf(
- parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK23),
- r ->
- r.assertSuccessWithOutput(
- String.format(EXPECTED_OUTPUT, matchException(), matchException())),
- r -> r.assertFailureWithErrorThatThrows(UnsupportedClassVersionError.class));
+ .assertSuccessWithOutput(
+ String.format(EXPECTED_OUTPUT, matchException(), matchException()));
}
private <T extends TestBuilder<?, T>> void addModifiedProgramClasses(
@@ -139,10 +138,6 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
- Assume.assumeTrue(
- parameters.isDexRuntime()
- || (parameters.isCfRuntime()
- && parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK23)));
testForR8(parameters.getBackend())
.apply(this::addModifiedProgramClasses)
.applyIf(
diff --git a/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/EnumSwitchTest.java b/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/EnumSwitchTest.java
index 585c7c2..4a27c29 100644
--- a/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/EnumSwitchTest.java
+++ b/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/EnumSwitchTest.java
@@ -18,7 +18,6 @@
import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.utils.StringUtils;
import com.android.tools.r8.utils.codeinspector.CodeInspector;
-import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -35,7 +34,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withCfRuntimesStartingFromIncluding(CfVm.JDK23)
+ .withDexRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .build();
}
public static String EXPECTED_OUTPUT =
@@ -52,10 +55,7 @@
testForJvm(parameters)
.apply(this::addModifiedProgramClasses)
.run(parameters.getRuntime(), Main.class)
- .applyIf(
- parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK23),
- r -> r.assertSuccessWithOutput(String.format(EXPECTED_OUTPUT, matchException())),
- r -> r.assertFailureWithErrorThatThrows(UnsupportedClassVersionError.class));
+ .assertSuccessWithOutput(String.format(EXPECTED_OUTPUT, matchException()));
}
private <T extends TestBuilder<?, T>> void addModifiedProgramClasses(
@@ -94,10 +94,6 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
- Assume.assumeTrue(
- parameters.isDexRuntime()
- || (parameters.isCfRuntime()
- && parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK23)));
testForR8(parameters.getBackend())
.apply(this::addModifiedProgramClasses)
.applyIf(
diff --git a/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/EnumSwitchUsingEnumSwitchBootstrapMethodTest.java b/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/EnumSwitchUsingEnumSwitchBootstrapMethodTest.java
index 4f68404..ed408fc 100644
--- a/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/EnumSwitchUsingEnumSwitchBootstrapMethodTest.java
+++ b/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/EnumSwitchUsingEnumSwitchBootstrapMethodTest.java
@@ -15,7 +15,6 @@
import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.utils.StringUtils;
import com.android.tools.r8.utils.codeinspector.CodeInspector;
-import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -32,7 +31,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withCfRuntimesStartingFromIncluding(CfVm.JDK23)
+ .withDexRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .build();
}
public static String EXPECTED_OUTPUT =
@@ -66,10 +69,7 @@
testForJvm(parameters)
.addInnerClassesAndStrippedOuter(getClass())
.run(parameters.getRuntime(), Main.class)
- .applyIf(
- parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK23),
- r -> r.assertSuccessWithOutput(EXPECTED_OUTPUT),
- r -> r.assertFailureWithErrorThatThrows(UnsupportedClassVersionError.class));
+ .assertSuccessWithOutput(EXPECTED_OUTPUT);
}
@Test
@@ -85,10 +85,6 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
- Assume.assumeTrue(
- parameters.isDexRuntime()
- || (parameters.isCfRuntime()
- && parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK23)));
testForR8(parameters.getBackend())
.addInnerClassesAndStrippedOuter(getClass())
.applyIf(
diff --git a/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/StringSwitchRegress382880986Test.java b/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/StringSwitchRegress382880986Test.java
index 0f5077e..10ad8a1 100644
--- a/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/StringSwitchRegress382880986Test.java
+++ b/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/StringSwitchRegress382880986Test.java
@@ -14,7 +14,6 @@
import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.utils.StringUtils;
import com.android.tools.r8.utils.codeinspector.CodeInspector;
-import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -29,7 +28,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimesAndApiLevels().build();
+ return getTestParameters()
+ .withCfRuntimesStartingFromIncluding(CfVm.JDK23)
+ .withDexRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .build();
}
private static final String EXPECTED_OUTPUT = StringUtils.lines("1", "2", "3");
@@ -46,10 +49,7 @@
testForJvm(parameters)
.addInnerClasses(getClass())
.run(parameters.getRuntime(), TestClass.class, "hello", "goodbye", "")
- .applyIf(
- parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK23),
- r -> r.assertSuccessWithOutput(EXPECTED_OUTPUT),
- r -> r.assertFailureWithErrorThatThrows(UnsupportedClassVersionError.class));
+ .assertSuccessWithOutput(EXPECTED_OUTPUT);
}
@Test
@@ -64,10 +64,7 @@
@Test
public void testR8() throws Exception {
- Assume.assumeTrue(
- parameters.isDexRuntime()
- || (parameters.isCfRuntime()
- && parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK23)));
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addInnerClassesAndStrippedOuter(getClass())
.applyIf(
diff --git a/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/StringSwitchTest.java b/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/StringSwitchTest.java
index 4782bf3..cd4b157 100644
--- a/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/StringSwitchTest.java
+++ b/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/StringSwitchTest.java
@@ -15,7 +15,6 @@
import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.utils.StringUtils;
import com.android.tools.r8.utils.codeinspector.CodeInspector;
-import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -32,7 +31,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withCfRuntimesStartingFromIncluding(CfVm.JDK23)
+ .withDexRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .build();
}
public static String EXPECTED_OUTPUT =
@@ -51,10 +54,7 @@
testForJvm(parameters)
.addInnerClassesAndStrippedOuter(getClass())
.run(parameters.getRuntime(), Main.class)
- .applyIf(
- parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK23),
- r -> r.assertSuccessWithOutput(EXPECTED_OUTPUT),
- r -> r.assertFailureWithErrorThatThrows(UnsupportedClassVersionError.class));
+ .assertSuccessWithOutput(EXPECTED_OUTPUT);
}
@Test
@@ -69,10 +69,6 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
- Assume.assumeTrue(
- parameters.isDexRuntime()
- || (parameters.isCfRuntime()
- && parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK23)));
testForR8(parameters.getBackend())
.addInnerClassesAndStrippedOuter(getClass())
.applyIf(
diff --git a/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/TypeSwitchMissingClassTest.java b/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/TypeSwitchMissingClassTest.java
index 8bb22d0..b4ac823 100644
--- a/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/TypeSwitchMissingClassTest.java
+++ b/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/TypeSwitchMissingClassTest.java
@@ -17,7 +17,6 @@
import com.android.tools.r8.utils.StringUtils;
import com.android.tools.r8.utils.codeinspector.CodeInspector;
import java.util.List;
-import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -39,7 +38,11 @@
@Parameters(name = "{0}, {1}")
public static List<Object[]> data() {
return buildParameters(
- getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build(),
+ getTestParameters()
+ .withCfRuntimesStartingFromIncluding(CfVm.JDK23)
+ .withDexRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .build(),
List.of(new ClassHolder(C.class), new ClassHolder(Color.class)));
}
@@ -71,10 +74,7 @@
testForJvm(parameters)
.apply(this::addModifiedProgramClasses)
.run(parameters.getRuntime(), Main.class)
- .applyIf(
- parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK23),
- this::assertResult,
- r -> r.assertFailureWithErrorThatThrows(UnsupportedClassVersionError.class));
+ .apply(this::assertResult);
}
private void assertResult(TestRunResult<?> r) {
@@ -104,10 +104,6 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
- Assume.assumeTrue(
- parameters.isDexRuntime()
- || (parameters.isCfRuntime()
- && parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK23)));
testForR8(parameters.getBackend())
.apply(this::addModifiedProgramClasses)
.applyIf(
diff --git a/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/TypeSwitchTest.java b/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/TypeSwitchTest.java
index 05584bc..686408d 100644
--- a/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/TypeSwitchTest.java
+++ b/src/test/java23/com/android/tools/r8/java23/switchpatternmatching/TypeSwitchTest.java
@@ -15,7 +15,6 @@
import com.android.tools.r8.ToolHelper;
import com.android.tools.r8.utils.StringUtils;
import com.android.tools.r8.utils.codeinspector.CodeInspector;
-import org.junit.Assume;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -32,7 +31,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withCfRuntimesStartingFromIncluding(CfVm.JDK23)
+ .withDexRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .build();
}
public static String EXPECTED_OUTPUT =
@@ -50,10 +53,7 @@
testForJvm(parameters)
.addInnerClassesAndStrippedOuter(getClass())
.run(parameters.getRuntime(), Main.class)
- .applyIf(
- parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK23),
- r -> r.assertSuccessWithOutput(EXPECTED_OUTPUT),
- r -> r.assertFailureWithErrorThatThrows(UnsupportedClassVersionError.class));
+ .assertSuccessWithOutput(EXPECTED_OUTPUT);
}
@Test
@@ -72,10 +72,6 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
- Assume.assumeTrue(
- parameters.isDexRuntime()
- || (parameters.isCfRuntime()
- && parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK23)));
testForR8(parameters.getBackend())
.addInnerClassesAndStrippedOuter(getClass())
.applyIf(