Fix type switch in R8 cf to cf
Bug: b/336510513
Change-Id: Ie3aa7af2094288f3c7602a3054eb7df2dc8cc5b7
diff --git a/src/test/examplesJava21/switchpatternmatching/StringSwitchTest.java b/src/test/examplesJava21/switchpatternmatching/StringSwitchTest.java
index 0b5bfa4..7b1fb6f 100644
--- a/src/test/examplesJava21/switchpatternmatching/StringSwitchTest.java
+++ b/src/test/examplesJava21/switchpatternmatching/StringSwitchTest.java
@@ -6,6 +6,7 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assume.assumeTrue;
+import com.android.tools.r8.JdkClassFileProvider;
import com.android.tools.r8.TestBase;
import com.android.tools.r8.TestParameters;
import com.android.tools.r8.TestParametersCollection;
@@ -90,9 +91,15 @@
@Test
public void testR8() throws Exception {
- Assume.assumeTrue("For Cf we should compile with Jdk 21 library", parameters.isDexRuntime());
+ Assume.assumeTrue(
+ parameters.isDexRuntime()
+ || (parameters.isCfRuntime()
+ && parameters.getCfRuntime().isNewerThanOrEqual(CfVm.JDK21)));
testForR8(parameters.getBackend())
.addInnerClassesAndStrippedOuter(getClass())
+ .applyIf(
+ parameters.isCfRuntime(),
+ b -> b.addLibraryProvider(JdkClassFileProvider.fromSystemJdk()))
.setMinApi(parameters)
.addKeepMainRule(Main.class)
.run(parameters.getRuntime(), Main.class)