Fix redundant running of R8 tests
Fixes: b/267266483
Change-Id: Ib249678eb371516e88a882b6ca44abde50d4d9a6
diff --git a/src/test/java/com/android/tools/r8/SupportedClassFileVersions.java b/src/test/java/com/android/tools/r8/SupportedClassFileVersions.java
index 2d6e5b2..151aca8 100644
--- a/src/test/java/com/android/tools/r8/SupportedClassFileVersions.java
+++ b/src/test/java/com/android/tools/r8/SupportedClassFileVersions.java
@@ -45,6 +45,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramClassFileData(dump(version))
.addKeepMainRule("Test")
diff --git a/src/test/java/com/android/tools/r8/TestParameters.java b/src/test/java/com/android/tools/r8/TestParameters.java
index 616d3c7..f7c958e 100644
--- a/src/test/java/com/android/tools/r8/TestParameters.java
+++ b/src/test/java/com/android/tools/r8/TestParameters.java
@@ -4,6 +4,7 @@
package com.android.tools.r8;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assume.assumeTrue;
@@ -165,9 +166,23 @@
assertEquals(NoneRuntime.getInstance(), runtime);
}
- public void assumeR8TestParameters() {
+ public TestParameters assumeCfRuntime() {
+ assumeTrue(isCfRuntime());
+ return this;
+ }
+
+ public TestParameters assumeDexRuntime() {
+ assumeTrue(isDexRuntime());
+ return this;
+ }
+
+ public TestParameters assumeR8TestParameters() {
+ assertFalse(
+ "No need to use assumeR8TestParameters() when not using api levels for CF",
+ isCfRuntime() && apiLevel == null);
assertTrue(apiLevel != null || representativeApiLevelForRuntime);
assumeTrue(isDexRuntime() || representativeApiLevelForRuntime);
+ return this;
}
public DexVm.Version getDexRuntimeVersion() {
diff --git a/src/test/java/com/android/tools/r8/androidapi/AndroidJarMasterTest.java b/src/test/java/com/android/tools/r8/androidapi/AndroidJarMasterTest.java
index 6f2a237..9edc6d5 100644
--- a/src/test/java/com/android/tools/r8/androidapi/AndroidJarMasterTest.java
+++ b/src/test/java/com/android/tools/r8/androidapi/AndroidJarMasterTest.java
@@ -40,6 +40,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addLibraryFiles(ToolHelper.getAndroidJar(AndroidApiLevel.MASTER))
.addInnerClasses(getClass())
diff --git a/src/test/java/com/android/tools/r8/androidapi/AndroidJarSv2Test.java b/src/test/java/com/android/tools/r8/androidapi/AndroidJarSv2Test.java
index ca29ab5..03dff7d 100644
--- a/src/test/java/com/android/tools/r8/androidapi/AndroidJarSv2Test.java
+++ b/src/test/java/com/android/tools/r8/androidapi/AndroidJarSv2Test.java
@@ -40,6 +40,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addLibraryFiles(ToolHelper.getAndroidJar(AndroidApiLevel.Sv2))
.addInnerClasses(getClass())
diff --git a/src/test/java/com/android/tools/r8/androidapi/AndroidJarTTest.java b/src/test/java/com/android/tools/r8/androidapi/AndroidJarTTest.java
index a812587..9865119 100644
--- a/src/test/java/com/android/tools/r8/androidapi/AndroidJarTTest.java
+++ b/src/test/java/com/android/tools/r8/androidapi/AndroidJarTTest.java
@@ -40,6 +40,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addLibraryFiles(ToolHelper.getAndroidJar(AndroidApiLevel.T))
.addInnerClasses(getClass())
diff --git a/src/test/java/com/android/tools/r8/apimodel/ApiModelClassMergingPackagePrivateTest.java b/src/test/java/com/android/tools/r8/apimodel/ApiModelClassMergingPackagePrivateTest.java
index 85ab556..c4df40d 100644
--- a/src/test/java/com/android/tools/r8/apimodel/ApiModelClassMergingPackagePrivateTest.java
+++ b/src/test/java/com/android/tools/r8/apimodel/ApiModelClassMergingPackagePrivateTest.java
@@ -111,6 +111,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.apply(this::setupTestBuilder)
.addKeepMainRule(Main.class)
diff --git a/src/test/java/com/android/tools/r8/apimodel/ApiModelIndirectTargetWithDifferentApiLevelTest.java b/src/test/java/com/android/tools/r8/apimodel/ApiModelIndirectTargetWithDifferentApiLevelTest.java
index 3c2923d..b41dea1 100644
--- a/src/test/java/com/android/tools/r8/apimodel/ApiModelIndirectTargetWithDifferentApiLevelTest.java
+++ b/src/test/java/com/android/tools/r8/apimodel/ApiModelIndirectTargetWithDifferentApiLevelTest.java
@@ -123,6 +123,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.apply(this::setupTestBuilder)
.addKeepMainRule(Main.class)
diff --git a/src/test/java/com/android/tools/r8/apimodel/ApiModelIndirectTargetWithSameApiLevelTest.java b/src/test/java/com/android/tools/r8/apimodel/ApiModelIndirectTargetWithSameApiLevelTest.java
index f6a0a49..69c33cb 100644
--- a/src/test/java/com/android/tools/r8/apimodel/ApiModelIndirectTargetWithSameApiLevelTest.java
+++ b/src/test/java/com/android/tools/r8/apimodel/ApiModelIndirectTargetWithSameApiLevelTest.java
@@ -111,6 +111,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.apply(this::setupTestBuilder)
.addKeepMainRule(Main.class)
diff --git a/src/test/java/com/android/tools/r8/apimodel/ApiModelMockAbstractMethodOnBaseToOutlineTest.java b/src/test/java/com/android/tools/r8/apimodel/ApiModelMockAbstractMethodOnBaseToOutlineTest.java
index 380702e..940e956 100644
--- a/src/test/java/com/android/tools/r8/apimodel/ApiModelMockAbstractMethodOnBaseToOutlineTest.java
+++ b/src/test/java/com/android/tools/r8/apimodel/ApiModelMockAbstractMethodOnBaseToOutlineTest.java
@@ -109,6 +109,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.apply(this::setupTestBuilder)
.addKeepMainRule(Main.class)
diff --git a/src/test/java/com/android/tools/r8/apimodel/ApiModelMockClassCheckCastTest.java b/src/test/java/com/android/tools/r8/apimodel/ApiModelMockClassCheckCastTest.java
index 05c405f..7544818 100644
--- a/src/test/java/com/android/tools/r8/apimodel/ApiModelMockClassCheckCastTest.java
+++ b/src/test/java/com/android/tools/r8/apimodel/ApiModelMockClassCheckCastTest.java
@@ -88,6 +88,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.apply(this::setupTestBuilder)
.addKeepMainRule(Main.class)
diff --git a/src/test/java/com/android/tools/r8/apimodel/ApiModelMockClassLoadingByClassForNameTest.java b/src/test/java/com/android/tools/r8/apimodel/ApiModelMockClassLoadingByClassForNameTest.java
index 0b76660..10b3ea2 100644
--- a/src/test/java/com/android/tools/r8/apimodel/ApiModelMockClassLoadingByClassForNameTest.java
+++ b/src/test/java/com/android/tools/r8/apimodel/ApiModelMockClassLoadingByClassForNameTest.java
@@ -88,6 +88,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.apply(this::setupTestBuilder)
.addKeepMainRule(Main.class)
diff --git a/src/test/java/com/android/tools/r8/apimodel/ApiModelMockClassLoadingByClassReferenceTest.java b/src/test/java/com/android/tools/r8/apimodel/ApiModelMockClassLoadingByClassReferenceTest.java
index 9074fcc..4850849 100644
--- a/src/test/java/com/android/tools/r8/apimodel/ApiModelMockClassLoadingByClassReferenceTest.java
+++ b/src/test/java/com/android/tools/r8/apimodel/ApiModelMockClassLoadingByClassReferenceTest.java
@@ -88,6 +88,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.apply(this::setupTestBuilder)
.addKeepMainRule(Main.class)
diff --git a/src/test/java/com/android/tools/r8/apimodel/ApiModelNoInliningOfHigherApiLevelSuperTest.java b/src/test/java/com/android/tools/r8/apimodel/ApiModelNoInliningOfHigherApiLevelSuperTest.java
index 9a239f8..b862c5e 100644
--- a/src/test/java/com/android/tools/r8/apimodel/ApiModelNoInliningOfHigherApiLevelSuperTest.java
+++ b/src/test/java/com/android/tools/r8/apimodel/ApiModelNoInliningOfHigherApiLevelSuperTest.java
@@ -22,20 +22,18 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class ApiModelNoInliningOfHigherApiLevelSuperTest extends TestBase {
- private final TestParameters parameters;
+ @Parameter(0)
+ public TestParameters parameters;
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
- }
-
- public ApiModelNoInliningOfHigherApiLevelSuperTest(TestParameters parameters) {
- this.parameters = parameters;
+ return getTestParameters().withAllRuntimesAndApiLevels().build();
}
@Test
diff --git a/src/test/java/com/android/tools/r8/apimodel/ApiModelNoInliningOfHigherApiLevelVirtualTest.java b/src/test/java/com/android/tools/r8/apimodel/ApiModelNoInliningOfHigherApiLevelVirtualTest.java
index c4a6c58..e16d9bc 100644
--- a/src/test/java/com/android/tools/r8/apimodel/ApiModelNoInliningOfHigherApiLevelVirtualTest.java
+++ b/src/test/java/com/android/tools/r8/apimodel/ApiModelNoInliningOfHigherApiLevelVirtualTest.java
@@ -20,20 +20,18 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class ApiModelNoInliningOfHigherApiLevelVirtualTest extends TestBase {
- private final TestParameters parameters;
+ @Parameter(0)
+ public TestParameters parameters;
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
- }
-
- public ApiModelNoInliningOfHigherApiLevelVirtualTest(TestParameters parameters) {
- this.parameters = parameters;
+ return getTestParameters().withAllRuntimesAndApiLevels().build();
}
@Test
diff --git a/src/test/java/com/android/tools/r8/apimodel/ApiModelOutlineCheckCastTest.java b/src/test/java/com/android/tools/r8/apimodel/ApiModelOutlineCheckCastTest.java
index 663a649..208c0d1 100644
--- a/src/test/java/com/android/tools/r8/apimodel/ApiModelOutlineCheckCastTest.java
+++ b/src/test/java/com/android/tools/r8/apimodel/ApiModelOutlineCheckCastTest.java
@@ -112,6 +112,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.apply(this::setupTestBuilder)
.addKeepMainRule(Main.class)
diff --git a/src/test/java/com/android/tools/r8/apimodel/ApiModelOutlineConstClassTest.java b/src/test/java/com/android/tools/r8/apimodel/ApiModelOutlineConstClassTest.java
index 64a3180..72157a0 100644
--- a/src/test/java/com/android/tools/r8/apimodel/ApiModelOutlineConstClassTest.java
+++ b/src/test/java/com/android/tools/r8/apimodel/ApiModelOutlineConstClassTest.java
@@ -98,6 +98,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.apply(this::setupTestBuilder)
.addKeepMainRule(Main.class)
diff --git a/src/test/java/com/android/tools/r8/apimodel/ApiModelOutlineInstanceOfTest.java b/src/test/java/com/android/tools/r8/apimodel/ApiModelOutlineInstanceOfTest.java
index 63e03a6..39b2125 100644
--- a/src/test/java/com/android/tools/r8/apimodel/ApiModelOutlineInstanceOfTest.java
+++ b/src/test/java/com/android/tools/r8/apimodel/ApiModelOutlineInstanceOfTest.java
@@ -111,6 +111,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.apply(this::setupTestBuilder)
.addKeepMainRule(Main.class)
diff --git a/src/test/java/com/android/tools/r8/cf/StackMapForThrowingInitializerTest.java b/src/test/java/com/android/tools/r8/cf/StackMapForThrowingInitializerTest.java
index e7a8f4f..ffb3334 100644
--- a/src/test/java/com/android/tools/r8/cf/StackMapForThrowingInitializerTest.java
+++ b/src/test/java/com/android/tools/r8/cf/StackMapForThrowingInitializerTest.java
@@ -56,6 +56,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramClassFileData(StackMapForThrowingInitializerTest$MainDump.dump())
.addKeepClassAndMembersRules(Main.class)
diff --git a/src/test/java/com/android/tools/r8/cf/methodhandles/InvokePolymorphicTypesTest.java b/src/test/java/com/android/tools/r8/cf/methodhandles/InvokePolymorphicTypesTest.java
index 58de21e..b32d175 100644
--- a/src/test/java/com/android/tools/r8/cf/methodhandles/InvokePolymorphicTypesTest.java
+++ b/src/test/java/com/android/tools/r8/cf/methodhandles/InvokePolymorphicTypesTest.java
@@ -4,14 +4,12 @@
package com.android.tools.r8.cf.methodhandles;
import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assume.assumeTrue;
import com.android.tools.r8.TestBase;
import com.android.tools.r8.TestParameters;
import com.android.tools.r8.TestParametersCollection;
import com.android.tools.r8.ToolHelper.DexVm.Version;
import com.android.tools.r8.references.Reference;
-import com.android.tools.r8.utils.AndroidApiLevel;
import com.android.tools.r8.utils.StringUtils;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
@@ -78,7 +76,7 @@
@Test
public void testR8() throws Exception {
- assumeTrue(parameters.isDexRuntime() || parameters.getApiLevel().equals(AndroidApiLevel.B));
+ parameters.assumeR8TestParameters();
boolean hasCompileSupport =
parameters.isCfRuntime()
|| parameters
diff --git a/src/test/java/com/android/tools/r8/cf/stackmap/InvalidStackHeightTest.java b/src/test/java/com/android/tools/r8/cf/stackmap/InvalidStackHeightTest.java
index f411d91..e29b8db 100644
--- a/src/test/java/com/android/tools/r8/cf/stackmap/InvalidStackHeightTest.java
+++ b/src/test/java/com/android/tools/r8/cf/stackmap/InvalidStackHeightTest.java
@@ -63,6 +63,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramClassFileData(getMainWithChangedMaxStackHeight())
.enableInliningAnnotations()
diff --git a/src/test/java/com/android/tools/r8/classmerging/horizontal/EquivalentConstructorsWithInterfaceValueToParentTest.java b/src/test/java/com/android/tools/r8/classmerging/horizontal/EquivalentConstructorsWithInterfaceValueToParentTest.java
index c45274f..7a1af72 100644
--- a/src/test/java/com/android/tools/r8/classmerging/horizontal/EquivalentConstructorsWithInterfaceValueToParentTest.java
+++ b/src/test/java/com/android/tools/r8/classmerging/horizontal/EquivalentConstructorsWithInterfaceValueToParentTest.java
@@ -14,20 +14,18 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class EquivalentConstructorsWithInterfaceValueToParentTest extends TestBase {
- private final TestParameters parameters;
+ @Parameter(0)
+ public TestParameters parameters;
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
- }
-
- public EquivalentConstructorsWithInterfaceValueToParentTest(TestParameters parameters) {
- this.parameters = parameters;
+ return getTestParameters().withAllRuntimesAndApiLevels().build();
}
@Test
diff --git a/src/test/java/com/android/tools/r8/classmerging/horizontal/EquivalentConstructorsWithPrimitiveAndReferencesParametersTest.java b/src/test/java/com/android/tools/r8/classmerging/horizontal/EquivalentConstructorsWithPrimitiveAndReferencesParametersTest.java
index d276d0c..9d09c4d 100644
--- a/src/test/java/com/android/tools/r8/classmerging/horizontal/EquivalentConstructorsWithPrimitiveAndReferencesParametersTest.java
+++ b/src/test/java/com/android/tools/r8/classmerging/horizontal/EquivalentConstructorsWithPrimitiveAndReferencesParametersTest.java
@@ -20,20 +20,18 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class EquivalentConstructorsWithPrimitiveAndReferencesParametersTest extends TestBase {
- private final TestParameters parameters;
+ @Parameter(0)
+ public TestParameters parameters;
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
- }
-
- public EquivalentConstructorsWithPrimitiveAndReferencesParametersTest(TestParameters parameters) {
- this.parameters = parameters;
+ return getTestParameters().withAllRuntimesAndApiLevels().build();
}
@Test
diff --git a/src/test/java/com/android/tools/r8/classmerging/horizontal/interfaces/CollisionWithDefaultMethodsTest.java b/src/test/java/com/android/tools/r8/classmerging/horizontal/interfaces/CollisionWithDefaultMethodsTest.java
index c4313e1..d40d1b9 100644
--- a/src/test/java/com/android/tools/r8/classmerging/horizontal/interfaces/CollisionWithDefaultMethodsTest.java
+++ b/src/test/java/com/android/tools/r8/classmerging/horizontal/interfaces/CollisionWithDefaultMethodsTest.java
@@ -8,8 +8,8 @@
import com.android.tools.r8.TestBase;
import com.android.tools.r8.TestParameters;
+import com.android.tools.r8.TestParametersCollection;
import com.android.tools.r8.utils.StringUtils;
-import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -22,9 +22,8 @@
@Parameter() public TestParameters parameters;
@Parameters(name = "{0}")
- public static List<Object[]> data() {
- return buildParameters(
- getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build());
+ public static TestParametersCollection data() {
+ return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
}
private static final String EXPECTED_OUTPUT =
@@ -40,6 +39,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addInnerClasses(getClass())
.addKeepMainRule(TestClass.class)
diff --git a/src/test/java/com/android/tools/r8/classmerging/vertical/VerticalClassMergerIndirectReflectiveNameTest.java b/src/test/java/com/android/tools/r8/classmerging/vertical/VerticalClassMergerIndirectReflectiveNameTest.java
index 0dd71da..6edb466 100644
--- a/src/test/java/com/android/tools/r8/classmerging/vertical/VerticalClassMergerIndirectReflectiveNameTest.java
+++ b/src/test/java/com/android/tools/r8/classmerging/vertical/VerticalClassMergerIndirectReflectiveNameTest.java
@@ -43,6 +43,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramClasses(Main.class, A.class, B.class)
.addKeepMainRule(Main.class)
diff --git a/src/test/java/com/android/tools/r8/classmerging/vertical/VerticalClassMergerReflectiveNameTest.java b/src/test/java/com/android/tools/r8/classmerging/vertical/VerticalClassMergerReflectiveNameTest.java
index da3165d..865b5bb 100644
--- a/src/test/java/com/android/tools/r8/classmerging/vertical/VerticalClassMergerReflectiveNameTest.java
+++ b/src/test/java/com/android/tools/r8/classmerging/vertical/VerticalClassMergerReflectiveNameTest.java
@@ -43,6 +43,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramClasses(Main.class, A.class, B.class)
.addKeepMainRule(Main.class)
diff --git a/src/test/java/com/android/tools/r8/desugar/DesugarInnerClassesInInterfaces.java b/src/test/java/com/android/tools/r8/desugar/DesugarInnerClassesInInterfaces.java
index 8902cd2..06c1b50 100644
--- a/src/test/java/com/android/tools/r8/desugar/DesugarInnerClassesInInterfaces.java
+++ b/src/test/java/com/android/tools/r8/desugar/DesugarInnerClassesInInterfaces.java
@@ -4,19 +4,18 @@
package com.android.tools.r8.desugar;
import static com.android.tools.r8.ir.desugar.itf.InterfaceDesugaringForTesting.getCompanionClassNameSuffix;
-import static org.junit.Assume.assumeTrue;
import com.android.tools.r8.DesugarTestConfiguration;
import com.android.tools.r8.TestBase;
import com.android.tools.r8.TestParameters;
import com.android.tools.r8.TestParametersCollection;
-import com.android.tools.r8.utils.AndroidApiLevel;
import com.google.common.collect.ImmutableList;
import java.util.List;
import java.util.concurrent.Callable;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class DesugarInnerClassesInInterfaces extends TestBase {
@@ -32,7 +31,7 @@
WithLocalInner.class.getName() + getCompanionClassNameSuffix(),
"true");
- @Parameterized.Parameters(name = "{0}")
+ @Parameters(name = "{0}")
public static TestParametersCollection data() {
return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
}
@@ -64,7 +63,7 @@
@Test
public void testR8Compat() throws Exception {
- assumeTrue(parameters.isDexRuntime() || parameters.getApiLevel() == AndroidApiLevel.B);
+ parameters.assumeR8TestParameters();
testForR8Compat(parameters.getBackend())
.addInnerClasses(DesugarInnerClassesInInterfaces.class)
.setMinApi(parameters.getApiLevel())
@@ -81,7 +80,7 @@
@Test
public void testR8Full() throws Exception {
- assumeTrue(parameters.isDexRuntime() || parameters.getApiLevel() == AndroidApiLevel.B);
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addInnerClasses(DesugarInnerClassesInInterfaces.class)
.setMinApi(parameters.getApiLevel())
diff --git a/src/test/java/com/android/tools/r8/desugar/DesugarLambdaWithAnonymousClass.java b/src/test/java/com/android/tools/r8/desugar/DesugarLambdaWithAnonymousClass.java
index 9fd70ef..17bbafd 100644
--- a/src/test/java/com/android/tools/r8/desugar/DesugarLambdaWithAnonymousClass.java
+++ b/src/test/java/com/android/tools/r8/desugar/DesugarLambdaWithAnonymousClass.java
@@ -25,6 +25,8 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
+import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class DesugarLambdaWithAnonymousClass extends TestBase {
@@ -38,16 +40,13 @@
+ " lambda$test$0$com-android-tools-r8-desugar-DesugarLambdaWithAnonymousClass$TestClass",
"Hello from inside lambda$testStatic$1");
- @Parameterized.Parameters(name = "{0}")
+ @Parameters(name = "{0}")
public static TestParametersCollection data() {
return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
}
- private final TestParameters parameters;
-
- public DesugarLambdaWithAnonymousClass(TestParameters parameters) {
- this.parameters = parameters;
- }
+ @Parameter(0)
+ public TestParameters parameters;
static class Counter {
private int count = 0;
@@ -112,6 +111,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
try {
testForR8(parameters.getBackend())
.addInnerClasses(DesugarLambdaWithAnonymousClass.class)
diff --git a/src/test/java/com/android/tools/r8/desugar/DesugarLambdaWithLocalClass.java b/src/test/java/com/android/tools/r8/desugar/DesugarLambdaWithLocalClass.java
index 76eb3d7..adfe2b4 100644
--- a/src/test/java/com/android/tools/r8/desugar/DesugarLambdaWithLocalClass.java
+++ b/src/test/java/com/android/tools/r8/desugar/DesugarLambdaWithLocalClass.java
@@ -110,6 +110,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addInnerClasses(DesugarLambdaWithLocalClass.class)
.setMinApi(parameters.getApiLevel())
diff --git a/src/test/java/com/android/tools/r8/desugar/DesugarToClassFileDeprecatedAttribute.java b/src/test/java/com/android/tools/r8/desugar/DesugarToClassFileDeprecatedAttribute.java
index 563ba1c..ebadde4 100644
--- a/src/test/java/com/android/tools/r8/desugar/DesugarToClassFileDeprecatedAttribute.java
+++ b/src/test/java/com/android/tools/r8/desugar/DesugarToClassFileDeprecatedAttribute.java
@@ -120,6 +120,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
R8FullTestBuilder builder =
testForR8(parameters.getBackend())
.addProgramClasses(TestClass.class)
diff --git a/src/test/java/com/android/tools/r8/desugar/InterfaceInvokePrivateTest.java b/src/test/java/com/android/tools/r8/desugar/InterfaceInvokePrivateTest.java
index 3ba706d..b377efa 100644
--- a/src/test/java/com/android/tools/r8/desugar/InterfaceInvokePrivateTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/InterfaceInvokePrivateTest.java
@@ -100,6 +100,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramClassFileData(transformIToPrivate(inputCfVersion))
.addProgramClasses(TestRunner.class)
diff --git a/src/test/java/com/android/tools/r8/desugar/VirtualInvokePrivateTest.java b/src/test/java/com/android/tools/r8/desugar/VirtualInvokePrivateTest.java
index 7b1eea2..c012532 100644
--- a/src/test/java/com/android/tools/r8/desugar/VirtualInvokePrivateTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/VirtualInvokePrivateTest.java
@@ -48,6 +48,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramClassFileData(transformInvokeSpecialToInvokeVirtual())
.addKeepMainRule(TestRunner.class)
diff --git a/src/test/java/com/android/tools/r8/desugar/backports/ThreadLocalBackportTest.java b/src/test/java/com/android/tools/r8/desugar/backports/ThreadLocalBackportTest.java
index 37c87dc..bf0036d 100644
--- a/src/test/java/com/android/tools/r8/desugar/backports/ThreadLocalBackportTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/backports/ThreadLocalBackportTest.java
@@ -58,6 +58,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addLibraryFiles(
parameters.isCfRuntime()
diff --git a/src/test/java/com/android/tools/r8/desugar/buffercovariantreturntype/BufferCovariantReturnTypeTest.java b/src/test/java/com/android/tools/r8/desugar/buffercovariantreturntype/BufferCovariantReturnTypeTest.java
index 2cd006d..c3fea3d 100644
--- a/src/test/java/com/android/tools/r8/desugar/buffercovariantreturntype/BufferCovariantReturnTypeTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/buffercovariantreturntype/BufferCovariantReturnTypeTest.java
@@ -65,6 +65,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramFiles(JAR)
.addKeepMainRule("buffercovariantreturntype.BufferCovariantReturnTypeMain")
diff --git a/src/test/java/com/android/tools/r8/desugar/constantdynamic/BasicConstantDynamicTest.java b/src/test/java/com/android/tools/r8/desugar/constantdynamic/BasicConstantDynamicTest.java
index e5a75ed..714c381 100644
--- a/src/test/java/com/android/tools/r8/desugar/constantdynamic/BasicConstantDynamicTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/constantdynamic/BasicConstantDynamicTest.java
@@ -74,7 +74,6 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
-
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
.setMinApi(parameters.getApiLevel())
diff --git a/src/test/java/com/android/tools/r8/desugar/constantdynamic/BootstrapMethodNotFoundConstantDynamicTest.java b/src/test/java/com/android/tools/r8/desugar/constantdynamic/BootstrapMethodNotFoundConstantDynamicTest.java
index 3abcc88..14a35d0 100644
--- a/src/test/java/com/android/tools/r8/desugar/constantdynamic/BootstrapMethodNotFoundConstantDynamicTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/constantdynamic/BootstrapMethodNotFoundConstantDynamicTest.java
@@ -72,7 +72,6 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
-
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
.setMinApi(parameters.getApiLevel())
diff --git a/src/test/java/com/android/tools/r8/desugar/constantdynamic/BootstrapMethodPrivateConstantDynamicTest.java b/src/test/java/com/android/tools/r8/desugar/constantdynamic/BootstrapMethodPrivateConstantDynamicTest.java
index a8fc8ce..e18f288 100644
--- a/src/test/java/com/android/tools/r8/desugar/constantdynamic/BootstrapMethodPrivateConstantDynamicTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/constantdynamic/BootstrapMethodPrivateConstantDynamicTest.java
@@ -71,7 +71,6 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
-
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
.setMinApi(parameters.getApiLevel())
diff --git a/src/test/java/com/android/tools/r8/desugar/constantdynamic/BootstrapMethodVirtualConstantDynamicTest.java b/src/test/java/com/android/tools/r8/desugar/constantdynamic/BootstrapMethodVirtualConstantDynamicTest.java
index d024c12..e39e6f5 100644
--- a/src/test/java/com/android/tools/r8/desugar/constantdynamic/BootstrapMethodVirtualConstantDynamicTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/constantdynamic/BootstrapMethodVirtualConstantDynamicTest.java
@@ -71,7 +71,6 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
-
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
.setMinApi(parameters.getApiLevel())
diff --git a/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicGetDeclaredMethodsTest.java b/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicGetDeclaredMethodsTest.java
index 7deff9c..2c58272 100644
--- a/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicGetDeclaredMethodsTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicGetDeclaredMethodsTest.java
@@ -8,6 +8,7 @@
import com.android.tools.r8.DesugarTestConfiguration;
import com.android.tools.r8.TestBase;
import com.android.tools.r8.TestParameters;
+import com.android.tools.r8.TestParametersCollection;
import com.android.tools.r8.TestRuntime.CfVm;
import com.android.tools.r8.ToolHelper.DexVm.Version;
import com.android.tools.r8.cf.CfVersion;
@@ -16,7 +17,6 @@
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.Method;
-import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -29,9 +29,8 @@
@Parameter() public TestParameters parameters;
@Parameters(name = "{0}")
- public static List<Object[]> data() {
- return buildParameters(
- getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build());
+ public static TestParametersCollection data() {
+ return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
}
private static final String EXPECTED_OUTPUT_WITH_METHOD_HANDLES =
diff --git a/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicInDefaultInterfaceMethodICCETest.java b/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicInDefaultInterfaceMethodICCETest.java
index b9bbf85..9b43848 100644
--- a/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicInDefaultInterfaceMethodICCETest.java
+++ b/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicInDefaultInterfaceMethodICCETest.java
@@ -74,7 +74,6 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
-
testForR8(parameters.getBackend())
.addProgramClasses(MAIN_CLASS)
.addProgramClassFileData(getTransformedClasses())
diff --git a/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicInDefaultInterfaceMethodTest.java b/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicInDefaultInterfaceMethodTest.java
index d4a92e0..bdf5591 100644
--- a/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicInDefaultInterfaceMethodTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicInDefaultInterfaceMethodTest.java
@@ -75,7 +75,6 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
-
testForR8(parameters.getBackend())
.addProgramClasses(MAIN_CLASS)
.addProgramClassFileData(getTransformedClasses())
diff --git a/src/test/java/com/android/tools/r8/desugar/constantdynamic/HierarchyConstantDynamicTest.java b/src/test/java/com/android/tools/r8/desugar/constantdynamic/HierarchyConstantDynamicTest.java
index 695ddd5..cee69bd 100644
--- a/src/test/java/com/android/tools/r8/desugar/constantdynamic/HierarchyConstantDynamicTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/constantdynamic/HierarchyConstantDynamicTest.java
@@ -66,7 +66,6 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
-
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
.setMinApi(parameters.getApiLevel())
diff --git a/src/test/java/com/android/tools/r8/desugar/constantdynamic/MultipleBootstrapMethodConstantDynamicTest.java b/src/test/java/com/android/tools/r8/desugar/constantdynamic/MultipleBootstrapMethodConstantDynamicTest.java
index b052264..254bda9 100644
--- a/src/test/java/com/android/tools/r8/desugar/constantdynamic/MultipleBootstrapMethodConstantDynamicTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/constantdynamic/MultipleBootstrapMethodConstantDynamicTest.java
@@ -75,7 +75,6 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
-
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
.setMinApi(parameters.getApiLevel())
diff --git a/src/test/java/com/android/tools/r8/desugar/constantdynamic/MultipleNamedConstantDynamicTest.java b/src/test/java/com/android/tools/r8/desugar/constantdynamic/MultipleNamedConstantDynamicTest.java
index 5ebc8da..17ed163 100644
--- a/src/test/java/com/android/tools/r8/desugar/constantdynamic/MultipleNamedConstantDynamicTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/constantdynamic/MultipleNamedConstantDynamicTest.java
@@ -75,9 +75,7 @@
@Test
public void testR8() throws Exception {
- assumeTrue(
- parameters.getRuntime().isDex() || parameters.getApiLevel().isEqualTo(AndroidApiLevel.B));
-
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
.setMinApi(parameters.getApiLevel())
diff --git a/src/test/java/com/android/tools/r8/desugar/constantdynamic/MultipleTypesConstantDynamicTest.java b/src/test/java/com/android/tools/r8/desugar/constantdynamic/MultipleTypesConstantDynamicTest.java
index fab07ce..33c63fa 100644
--- a/src/test/java/com/android/tools/r8/desugar/constantdynamic/MultipleTypesConstantDynamicTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/constantdynamic/MultipleTypesConstantDynamicTest.java
@@ -74,9 +74,7 @@
@Test
public void testR8() throws Exception {
- assumeTrue(
- parameters.getRuntime().isDex() || parameters.getApiLevel().isEqualTo(AndroidApiLevel.B));
-
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
.setMinApi(parameters.getApiLevel())
diff --git a/src/test/java/com/android/tools/r8/desugar/constantdynamic/SharedBootstrapMethodConstantDynamicTest.java b/src/test/java/com/android/tools/r8/desugar/constantdynamic/SharedBootstrapMethodConstantDynamicTest.java
index 486b958..87c74d3 100644
--- a/src/test/java/com/android/tools/r8/desugar/constantdynamic/SharedBootstrapMethodConstantDynamicTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/constantdynamic/SharedBootstrapMethodConstantDynamicTest.java
@@ -141,7 +141,7 @@
@Test
public void testR8Cf() {
- assumeTrue(parameters.isCfRuntime() && parameters.getApiLevel().isEqualTo(AndroidApiLevel.B));
+ parameters.assumeCfRuntime().assumeR8TestParameters();
assertThrows(
CompilationFailedException.class,
() ->
@@ -159,7 +159,7 @@
@Test
public void testR8Dex() throws Exception {
- assumeTrue(parameters.isDexRuntime());
+ parameters.assumeDexRuntime();
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
.addLibraryFiles(ToolHelper.getMostRecentAndroidJar())
diff --git a/src/test/java/com/android/tools/r8/desugar/jdk8272564/Jdk8272564InvalidCode.java b/src/test/java/com/android/tools/r8/desugar/jdk8272564/Jdk8272564InvalidCode.java
index ddd3386..c9dbd5c 100644
--- a/src/test/java/com/android/tools/r8/desugar/jdk8272564/Jdk8272564InvalidCode.java
+++ b/src/test/java/com/android/tools/r8/desugar/jdk8272564/Jdk8272564InvalidCode.java
@@ -64,7 +64,7 @@
@Test
public void testR8() throws Exception {
- assumeTrue(parameters.isDexRuntime() || isDefaultCfParameters());
+ parameters.assumeR8TestParameters();
// The R8 lens code rewriter rewrites to the code prior to fixing JDK-8272564.
testForR8(parameters.getBackend())
.addProgramClasses(I.class)
diff --git a/src/test/java/com/android/tools/r8/desugar/jdk8272564/Jdk8272564Test.java b/src/test/java/com/android/tools/r8/desugar/jdk8272564/Jdk8272564Test.java
index 7ee4955..85dedf3 100644
--- a/src/test/java/com/android/tools/r8/desugar/jdk8272564/Jdk8272564Test.java
+++ b/src/test/java/com/android/tools/r8/desugar/jdk8272564/Jdk8272564Test.java
@@ -152,7 +152,7 @@
@Test
public void testR8() throws Exception {
- assumeTrue(parameters.isDexRuntime() || isDefaultCfParameters());
+ parameters.assumeR8TestParameters();
// The R8 lens code rewriter rewrites to the code prior to fixing JDK-8272564.
testForR8(parameters.getBackend())
.addProgramFiles(Jdk8272564.jar())
diff --git a/src/test/java/com/android/tools/r8/desugar/lambdas/LambdaEqualityTest.java b/src/test/java/com/android/tools/r8/desugar/lambdas/LambdaEqualityTest.java
index bf4f43f..579f000 100644
--- a/src/test/java/com/android/tools/r8/desugar/lambdas/LambdaEqualityTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/lambdas/LambdaEqualityTest.java
@@ -101,6 +101,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addInnerClasses(LambdaEqualityTest.class)
.setMinApi(parameters.getApiLevel())
diff --git a/src/test/java/com/android/tools/r8/desugar/lambdas/LambdaFactoryTest.java b/src/test/java/com/android/tools/r8/desugar/lambdas/LambdaFactoryTest.java
index 21ed11f..bed4577 100644
--- a/src/test/java/com/android/tools/r8/desugar/lambdas/LambdaFactoryTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/lambdas/LambdaFactoryTest.java
@@ -109,6 +109,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addInnerClasses(getClass())
.addKeepMainRule(TestClass.class)
diff --git a/src/test/java/com/android/tools/r8/desugar/lambdas/LambdaMethodsWithModifiedAccessTest.java b/src/test/java/com/android/tools/r8/desugar/lambdas/LambdaMethodsWithModifiedAccessTest.java
index 5802f93..3bd5016 100644
--- a/src/test/java/com/android/tools/r8/desugar/lambdas/LambdaMethodsWithModifiedAccessTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/lambdas/LambdaMethodsWithModifiedAccessTest.java
@@ -101,6 +101,7 @@
// || (implHandle.type.isInvokeDirect() && isPublicizedInstanceMethod(target));
@Test(expected = CompilationFailedException.class)
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramClasses(TestClass.class)
.addProgramClassFileData(getTransformedLambdaTest())
diff --git a/src/test/java/com/android/tools/r8/desugar/lambdas/OverlappingLambdaMethodInSubclassWithSameNameTest.java b/src/test/java/com/android/tools/r8/desugar/lambdas/OverlappingLambdaMethodInSubclassWithSameNameTest.java
index 9f5fa37..84ce7aa 100644
--- a/src/test/java/com/android/tools/r8/desugar/lambdas/OverlappingLambdaMethodInSubclassWithSameNameTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/lambdas/OverlappingLambdaMethodInSubclassWithSameNameTest.java
@@ -60,6 +60,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramClasses(
MAIN_CLASS,
diff --git a/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestAttributesInDexShrinkingFieldsTest.java b/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestAttributesInDexShrinkingFieldsTest.java
index 8e6e694..a3cbac7 100644
--- a/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestAttributesInDexShrinkingFieldsTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestAttributesInDexShrinkingFieldsTest.java
@@ -79,6 +79,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
assumeTrue(parameters.isDexRuntime() || isRuntimeWithNestSupport(parameters.asCfRuntime()));
// TODO(b/247047415): Update test when a DEX VM natively supporting nests is added.
assertFalse(parameters.getApiLevel().getLevel() > 33);
@@ -96,6 +97,7 @@
@Test
public void testR8KeepHostWithPrivateMembers() throws Exception {
+ parameters.assumeR8TestParameters();
assumeTrue(parameters.isDexRuntime() || isRuntimeWithNestSupport(parameters.asCfRuntime()));
// TODO(b/247047415): Update test when a DEX VM natively supporting nests is added.
assertFalse(parameters.getApiLevel().getLevel() > 33);
@@ -117,6 +119,7 @@
@Test
public void testR8KeepHostWithPublicMembers() throws Exception {
+ parameters.assumeR8TestParameters();
assumeTrue(parameters.isDexRuntime() || isRuntimeWithNestSupport(parameters.asCfRuntime()));
// TODO(b/247047415): Update test when a DEX VM natively supporting nests is added.
assertFalse(parameters.getApiLevel().getLevel() > 33);
diff --git a/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestAttributesInDexShrinkingMethodsTest.java b/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestAttributesInDexShrinkingMethodsTest.java
index d710ad0..6f68a7a 100644
--- a/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestAttributesInDexShrinkingMethodsTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestAttributesInDexShrinkingMethodsTest.java
@@ -78,6 +78,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
assumeTrue(parameters.isDexRuntime() || isRuntimeWithNestSupport(parameters.asCfRuntime()));
// TODO(b/247047415): Update test when a DEX VM natively supporting nests is added.
assertFalse(parameters.getApiLevel().getLevel() > 33);
@@ -95,6 +96,7 @@
@Test
public void testR8KeepHostWithPrivateMembers() throws Exception {
+ parameters.assumeR8TestParameters();
assumeTrue(parameters.isDexRuntime() || isRuntimeWithNestSupport(parameters.asCfRuntime()));
// TODO(b/247047415): Update test when a DEX VM natively supporting nests is added.
assertFalse(parameters.getApiLevel().getLevel() > 33);
@@ -116,6 +118,7 @@
@Test
public void testR8KeepHostWithPublicMembers() throws Exception {
+ parameters.assumeR8TestParameters();
assumeTrue(parameters.isDexRuntime() || isRuntimeWithNestSupport(parameters.asCfRuntime()));
// TODO(b/247047415): Update test when a DEX VM natively supporting nests is added.
assertFalse(parameters.getApiLevel().getLevel() > 33);
diff --git a/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestAttributesInDexTest.java b/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestAttributesInDexTest.java
index 25f211f..775c7ae 100644
--- a/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestAttributesInDexTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestAttributesInDexTest.java
@@ -137,6 +137,7 @@
@Test
public void testR8NoKeep() throws Exception {
+ parameters.assumeR8TestParameters();
assumeTrue(parameters.isDexRuntime() || isRuntimeWithNestSupport(parameters.asCfRuntime()));
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
@@ -155,6 +156,7 @@
@Test
public void testR8KeepHost() throws Exception {
+ parameters.assumeR8TestParameters();
assumeTrue(parameters.isDexRuntime() || isRuntimeWithNestSupport(parameters.asCfRuntime()));
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
@@ -175,6 +177,7 @@
@Test
public void testR8KeepMembers() throws Exception {
+ parameters.assumeR8TestParameters();
assumeTrue(parameters.isDexRuntime() || isRuntimeWithNestSupport(parameters.asCfRuntime()));
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
@@ -195,6 +198,7 @@
@Test
public void testR8KeepBoth() throws Exception {
+ parameters.assumeR8TestParameters();
assumeTrue(parameters.isDexRuntime() || isRuntimeWithNestSupport(parameters.asCfRuntime()));
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
diff --git a/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestAttributesUpdateTest.java b/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestAttributesUpdateTest.java
index 735e59c..0a7c200 100644
--- a/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestAttributesUpdateTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestAttributesUpdateTest.java
@@ -27,16 +27,14 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class NestAttributesUpdateTest extends TestBase {
- public NestAttributesUpdateTest(TestParameters parameters) {
- this.parameters = parameters;
- }
-
- private final TestParameters parameters;
+ @Parameter(0)
+ public TestParameters parameters;
private final String MERGING_OUTER_CLASS = "BasicNestHostClassMerging";
private final String PRUNING_OUTER_CLASS = "BasicNestHostTreePruning";
@@ -47,7 +45,6 @@
public static TestParametersCollection data() {
return getTestParameters()
.withCfRuntimesStartingFromIncluding(CfVm.JDK11)
- .withAllApiLevelsAlsoForCf()
.build();
}
diff --git a/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestClassMergingTest.java b/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestClassMergingTest.java
index c3806df..322fb9b 100644
--- a/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestClassMergingTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestClassMergingTest.java
@@ -16,16 +16,14 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class NestClassMergingTest extends TestBase {
- public NestClassMergingTest(TestParameters parameters) {
- this.parameters = parameters;
- }
-
- private final TestParameters parameters;
+ @Parameter(0)
+ public TestParameters parameters;
private final String NEST_MAIN_CLASS = PACKAGE_NAME + "NestHostInlining";
private final String NEST_SUBCLASS_MAIN_CLASS = PACKAGE_NAME + "NestHostInliningSubclasses";
@@ -44,7 +42,6 @@
public static TestParametersCollection data() {
return getTestParameters()
.withCfRuntimesStartingFromIncluding(CfVm.JDK11)
- .withAllApiLevelsAlsoForCf()
.build();
}
diff --git a/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestLambdaJava17Test.java b/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestLambdaJava17Test.java
index a166409..e9de7f8 100644
--- a/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestLambdaJava17Test.java
+++ b/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestLambdaJava17Test.java
@@ -64,6 +64,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramFiles(JDK17_JAR)
.applyIf(
diff --git a/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestMethodInlinedTest.java b/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestMethodInlinedTest.java
index 155d082..4dbc4c3e 100644
--- a/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestMethodInlinedTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestMethodInlinedTest.java
@@ -52,6 +52,7 @@
@Test
public void testPvtMethodCallInlined() throws Exception {
+ parameters.assumeR8TestParameters();
List<Path> toCompile = classesMatching("NestPvtMethodCallInlined");
testForR8(parameters.getBackend())
.addKeepMainRule(getMainClass("pvtCallInlined"))
diff --git a/src/test/java/com/android/tools/r8/desugar/records/EmptyRecordAnnotationTest.java b/src/test/java/com/android/tools/r8/desugar/records/EmptyRecordAnnotationTest.java
index 8de3689..b56ffdb 100644
--- a/src/test/java/com/android/tools/r8/desugar/records/EmptyRecordAnnotationTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/records/EmptyRecordAnnotationTest.java
@@ -4,7 +4,6 @@
package com.android.tools.r8.desugar.records;
-import static org.junit.Assume.assumeTrue;
import com.android.tools.r8.R8FullTestBuilder;
import com.android.tools.r8.TestBase;
@@ -67,7 +66,7 @@
@Test
public void testR8() throws Exception {
- assumeTrue(parameters.isDexRuntime() || isDefaultCfParameters());
+ parameters.assumeR8TestParameters();
R8FullTestBuilder builder =
testForR8(parameters.getBackend())
.addProgramClassFileData(PROGRAM_DATA)
diff --git a/src/test/java/com/android/tools/r8/desugar/records/EmptyRecordTest.java b/src/test/java/com/android/tools/r8/desugar/records/EmptyRecordTest.java
index 75dc0c4..7c56c29 100644
--- a/src/test/java/com/android/tools/r8/desugar/records/EmptyRecordTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/records/EmptyRecordTest.java
@@ -65,6 +65,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramClassFileData(PROGRAM_DATA)
.addKeepMainRule(MAIN_TYPE)
diff --git a/src/test/java/com/android/tools/r8/desugar/records/RecordClasspathTest.java b/src/test/java/com/android/tools/r8/desugar/records/RecordClasspathTest.java
index 6860b8b..5376f89 100644
--- a/src/test/java/com/android/tools/r8/desugar/records/RecordClasspathTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/records/RecordClasspathTest.java
@@ -105,6 +105,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
R8FullTestBuilder builder =
testForR8(parameters.getBackend())
.addProgramClasses(TestClass.class)
diff --git a/src/test/java/com/android/tools/r8/desugar/records/RecordInstanceOfTest.java b/src/test/java/com/android/tools/r8/desugar/records/RecordInstanceOfTest.java
index f0d89d6..d92f1dc 100644
--- a/src/test/java/com/android/tools/r8/desugar/records/RecordInstanceOfTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/records/RecordInstanceOfTest.java
@@ -56,6 +56,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
R8FullTestBuilder builder =
testForR8(parameters.getBackend())
.addProgramClassFileData(PROGRAM_DATA)
diff --git a/src/test/java/com/android/tools/r8/desugar/records/RecordInvokeCustomSplitDesugaringTest.java b/src/test/java/com/android/tools/r8/desugar/records/RecordInvokeCustomSplitDesugaringTest.java
index f6c39e6..30691a8 100644
--- a/src/test/java/com/android/tools/r8/desugar/records/RecordInvokeCustomSplitDesugaringTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/records/RecordInvokeCustomSplitDesugaringTest.java
@@ -67,6 +67,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
Path desugared =
testForD8(Backend.CF)
.addProgramClassFileData(PROGRAM_DATA)
diff --git a/src/test/java/com/android/tools/r8/desugar/records/RecordInvokeCustomTest.java b/src/test/java/com/android/tools/r8/desugar/records/RecordInvokeCustomTest.java
index b851c88..cda5724 100644
--- a/src/test/java/com/android/tools/r8/desugar/records/RecordInvokeCustomTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/records/RecordInvokeCustomTest.java
@@ -73,6 +73,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
R8FullTestBuilder builder =
testForR8(parameters.getBackend())
.addProgramClassFileData(PROGRAM_DATA)
diff --git a/src/test/java/com/android/tools/r8/desugar/records/RecordLibMergeTest.java b/src/test/java/com/android/tools/r8/desugar/records/RecordLibMergeTest.java
index 1701934..0671e9e 100644
--- a/src/test/java/com/android/tools/r8/desugar/records/RecordLibMergeTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/records/RecordLibMergeTest.java
@@ -43,6 +43,7 @@
@Test
public void testR8Merge() throws Exception {
+ parameters.assumeR8TestParameters();
Path lib =
testForR8(Backend.CF)
.addProgramClassFileData(PROGRAM_DATA_LIB)
diff --git a/src/test/java/com/android/tools/r8/desugar/records/RecordShrinkFieldTest.java b/src/test/java/com/android/tools/r8/desugar/records/RecordShrinkFieldTest.java
index a8073f5..e9981a2 100644
--- a/src/test/java/com/android/tools/r8/desugar/records/RecordShrinkFieldTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/records/RecordShrinkFieldTest.java
@@ -62,6 +62,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramClassFileData(PROGRAM_DATA)
.setMinApi(parameters.getApiLevel())
@@ -76,6 +77,7 @@
@Test
public void testR8CfThenDex() throws Exception {
+ parameters.assumeR8TestParameters();
Path desugared =
testForR8(Backend.CF)
.addProgramClassFileData(PROGRAM_DATA)
diff --git a/src/test/java/com/android/tools/r8/desugar/records/RecordWithMembersTest.java b/src/test/java/com/android/tools/r8/desugar/records/RecordWithMembersTest.java
index 07ae7cb..cd9d4c3 100644
--- a/src/test/java/com/android/tools/r8/desugar/records/RecordWithMembersTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/records/RecordWithMembersTest.java
@@ -58,6 +58,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
R8FullTestBuilder builder =
testForR8(parameters.getBackend())
.addProgramClassFileData(PROGRAM_DATA)
diff --git a/src/test/java/com/android/tools/r8/desugar/records/RecordWithNonMaterializableConstClassTest.java b/src/test/java/com/android/tools/r8/desugar/records/RecordWithNonMaterializableConstClassTest.java
index 7ee039f..6a28af7 100644
--- a/src/test/java/com/android/tools/r8/desugar/records/RecordWithNonMaterializableConstClassTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/records/RecordWithNonMaterializableConstClassTest.java
@@ -4,14 +4,18 @@
package com.android.tools.r8.desugar.records;
+import com.android.tools.r8.R8FullTestBuilder;
import com.android.tools.r8.TestBase;
import com.android.tools.r8.TestParameters;
+import com.android.tools.r8.TestParametersCollection;
+import com.android.tools.r8.TestRuntime.CfVm;
import com.android.tools.r8.utils.StringUtils;
import java.nio.file.Path;
-import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
+import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class RecordWithNonMaterializableConstClassTest extends TestBase {
@@ -29,17 +33,16 @@
String.format(EXPECTED_RESULT_FORMAT, "MyRecordWithConstClass", "theClass");
private static final String EXPECTED_RESULT_R8 = String.format(EXPECTED_RESULT_FORMAT, "a", "a");
- private final TestParameters parameters;
+ @Parameter(0)
+ public TestParameters parameters;
- public RecordWithNonMaterializableConstClassTest(TestParameters parameters) {
- this.parameters = parameters;
- }
-
- @Parameterized.Parameters(name = "{0}")
- public static List<Object[]> data() {
- // TODO(b/174431251): This should be replaced with .withCfRuntimes(start = jdk17).
- return buildParameters(
- getTestParameters().withDexRuntimes().withAllApiLevelsAlsoForCf().build());
+ @Parameters(name = "{0}")
+ public static TestParametersCollection data() {
+ return getTestParameters()
+ .withCfRuntimesStartingFromIncluding(CfVm.JDK17)
+ .withDexRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .build();
}
@Test
@@ -62,36 +65,42 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramClassFileData(PROGRAM_DATA)
.addProgramClassFileData(EXTRA_DATA)
- .setMinApi(parameters.getApiLevel())
- .addKeepMainRule(MAIN_TYPE)
- .addKeepRules("-keep class " + PRIVATE_CLASS_NAME)
+ .apply(this::configureR8)
.compile()
.run(parameters.getRuntime(), MAIN_TYPE)
.assertSuccessWithOutput(EXPECTED_RESULT_R8);
}
@Test
- public void testR8CfThenDex() throws Exception {
+ public void testR8CfThenRecompile() throws Exception {
+ parameters.assumeR8TestParameters();
Path desugared =
testForR8(Backend.CF)
.addProgramClassFileData(PROGRAM_DATA)
.addProgramClassFileData(EXTRA_DATA)
- .setMinApi(parameters.getApiLevel())
- .addKeepMainRule(MAIN_TYPE)
- .addKeepRules("-keep class " + PRIVATE_CLASS_NAME)
.addLibraryFiles(RecordTestUtils.getJdk15LibraryFiles(temp))
+ .apply(this::configureR8)
.compile()
.writeToZip();
testForR8(parameters.getBackend())
.addProgramFiles(desugared)
- .setMinApi(parameters.getApiLevel())
- .addKeepMainRule(MAIN_TYPE)
- .addKeepRules("-keep class " + PRIVATE_CLASS_NAME)
+ .apply(this::configureR8)
.compile()
.run(parameters.getRuntime(), MAIN_TYPE)
.assertSuccessWithOutput(EXPECTED_RESULT_R8);
}
+
+ private void configureR8(R8FullTestBuilder testBuilder) {
+ testBuilder
+ .addKeepMainRule(MAIN_TYPE)
+ .addKeepRules("-keep class " + PRIVATE_CLASS_NAME)
+ .setMinApi(parameters.getApiLevel())
+ .applyIf(
+ parameters.isCfRuntime(),
+ b -> b.addLibraryFiles(RecordTestUtils.getJdk15LibraryFiles(temp)));
+ }
}
diff --git a/src/test/java/com/android/tools/r8/desugar/records/SimpleRecordTest.java b/src/test/java/com/android/tools/r8/desugar/records/SimpleRecordTest.java
index 96af73c..7b4c893 100644
--- a/src/test/java/com/android/tools/r8/desugar/records/SimpleRecordTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/records/SimpleRecordTest.java
@@ -10,15 +10,17 @@
import com.android.tools.r8.R8FullTestBuilder;
import com.android.tools.r8.TestBase;
import com.android.tools.r8.TestParameters;
+import com.android.tools.r8.TestParametersCollection;
import com.android.tools.r8.TestRuntime.CfVm;
import com.android.tools.r8.synthesis.globals.GlobalSyntheticsTestingConsumer;
import com.android.tools.r8.utils.AndroidApiLevel;
import com.android.tools.r8.utils.StringUtils;
import java.nio.file.Path;
-import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
+import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class SimpleRecordTest extends TestBase {
@@ -29,22 +31,15 @@
private static final String EXPECTED_RESULT =
StringUtils.lines("Jane Doe", "42", "Jane Doe", "42");
- private final TestParameters parameters;
+ @Parameter(0)
+ public TestParameters parameters;
- public SimpleRecordTest(TestParameters parameters) {
- this.parameters = parameters;
+ @Parameters(name = "{0}")
+ public static TestParametersCollection data() {
+ return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
}
- @Parameterized.Parameters(name = "{0}")
- public static List<Object[]> data() {
- return buildParameters(
- getTestParameters()
- .withAllRuntimes()
- .withAllApiLevelsAlsoForCf()
- .build());
- }
-
- private boolean isCfWithNativeRecordSupport() {
+ private boolean isCfRuntimeWithNativeRecordSupport() {
return parameters.isCfRuntime()
&& parameters.asCfRuntime().isNewerThanOrEqual(CfVm.JDK14)
&& parameters.getApiLevel().equals(AndroidApiLevel.B);
@@ -52,7 +47,7 @@
@Test
public void testReference() throws Exception {
- assumeTrue(isCfWithNativeRecordSupport());
+ assumeTrue(isCfRuntimeWithNativeRecordSupport());
testForJvm()
.addProgramClassFileData(PROGRAM_DATA)
.run(parameters.getRuntime(), MAIN_TYPE)
@@ -122,7 +117,8 @@
@Test
public void testR8() throws Exception {
- assumeTrue(parameters.isDexRuntime() || isCfWithNativeRecordSupport());
+ parameters.assumeR8TestParameters();
+ assumeTrue(parameters.isDexRuntime() || isCfRuntimeWithNativeRecordSupport());
R8FullTestBuilder builder =
testForR8(parameters.getBackend())
.addProgramClassFileData(PROGRAM_DATA)
@@ -148,7 +144,8 @@
@Test
public void testR8NoMinification() throws Exception {
- assumeTrue(parameters.isDexRuntime() || isCfWithNativeRecordSupport());
+ parameters.assumeR8TestParameters();
+ assumeTrue(parameters.isDexRuntime() || isCfRuntimeWithNativeRecordSupport());
R8FullTestBuilder builder =
testForR8(parameters.getBackend())
.addProgramClassFileData(PROGRAM_DATA)
diff --git a/src/test/java/com/android/tools/r8/desugar/records/UnusedRecordFieldTest.java b/src/test/java/com/android/tools/r8/desugar/records/UnusedRecordFieldTest.java
index bd59f23..8b0f9aa 100644
--- a/src/test/java/com/android/tools/r8/desugar/records/UnusedRecordFieldTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/records/UnusedRecordFieldTest.java
@@ -56,6 +56,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
R8FullTestBuilder builder =
testForR8(parameters.getBackend())
.addProgramClassFileData(PROGRAM_DATA)
diff --git a/src/test/java/com/android/tools/r8/desugar/records/UnusedRecordMethodTest.java b/src/test/java/com/android/tools/r8/desugar/records/UnusedRecordMethodTest.java
index 70ed745..607b9aa 100644
--- a/src/test/java/com/android/tools/r8/desugar/records/UnusedRecordMethodTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/records/UnusedRecordMethodTest.java
@@ -56,6 +56,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
R8FullTestBuilder builder =
testForR8(parameters.getBackend())
.addProgramClassFileData(PROGRAM_DATA)
diff --git a/src/test/java/com/android/tools/r8/desugar/records/UnusedRecordReflectionTest.java b/src/test/java/com/android/tools/r8/desugar/records/UnusedRecordReflectionTest.java
index 066c68b..498cf71 100644
--- a/src/test/java/com/android/tools/r8/desugar/records/UnusedRecordReflectionTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/records/UnusedRecordReflectionTest.java
@@ -56,6 +56,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
R8FullTestBuilder builder =
testForR8(parameters.getBackend())
.addProgramClassFileData(PROGRAM_DATA)
diff --git a/src/test/java/com/android/tools/r8/desugar/sealed/SealedAttributeTest.java b/src/test/java/com/android/tools/r8/desugar/sealed/SealedAttributeTest.java
index e57e215..8748705 100644
--- a/src/test/java/com/android/tools/r8/desugar/sealed/SealedAttributeTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/sealed/SealedAttributeTest.java
@@ -61,6 +61,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
R8FullTestBuilder builder =
testForR8(parameters.getBackend())
.addProgramFiles(Sealed.jar())
diff --git a/src/test/java/com/android/tools/r8/desugar/staticinterfacemethod/InvokeStaticInterfaceNestedTest.java b/src/test/java/com/android/tools/r8/desugar/staticinterfacemethod/InvokeStaticInterfaceNestedTest.java
index 825e3ea..2eb135a 100644
--- a/src/test/java/com/android/tools/r8/desugar/staticinterfacemethod/InvokeStaticInterfaceNestedTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/staticinterfacemethod/InvokeStaticInterfaceNestedTest.java
@@ -7,7 +7,6 @@
import static com.android.tools.r8.desugar.staticinterfacemethod.InvokeStaticInterfaceNestedTest.Library.foo;
import static org.junit.Assert.assertThrows;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
import com.android.tools.r8.CompilationFailedException;
import com.android.tools.r8.DesugarTestConfiguration;
@@ -18,7 +17,6 @@
import com.android.tools.r8.TestRunResult;
import com.android.tools.r8.TestRuntime.CfVm;
import com.android.tools.r8.ToolHelper.DexVm.Version;
-import com.android.tools.r8.utils.AndroidApiLevel;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -84,8 +82,8 @@
@Test
public void testR8() throws Exception {
- assumeTrue(parameters.isDexRuntime() || parameters.getApiLevel() == AndroidApiLevel.B);
- final R8FullTestBuilder testBuilder =
+ parameters.assumeR8TestParameters();
+ R8FullTestBuilder testBuilder =
testForR8(parameters.getBackend())
.addProgramClassFileData(
rewriteToUseNonInterfaceMethodReference(Main.class, "main"),
diff --git a/src/test/java/com/android/tools/r8/desugar/suppressedexceptions/SuppressedExceptionsTest.java b/src/test/java/com/android/tools/r8/desugar/suppressedexceptions/SuppressedExceptionsTest.java
index e4386e4..17b079f 100644
--- a/src/test/java/com/android/tools/r8/desugar/suppressedexceptions/SuppressedExceptionsTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/suppressedexceptions/SuppressedExceptionsTest.java
@@ -6,34 +6,31 @@
import static com.android.tools.r8.desugar.suppressedexceptions.TwrSuppressedExceptionsTest.getInvokesTo;
import static com.android.tools.r8.desugar.suppressedexceptions.TwrSuppressedExceptionsTest.hasInvokesTo;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assume.assumeTrue;
import com.android.tools.r8.DesugarTestConfiguration;
import com.android.tools.r8.TestBase;
import com.android.tools.r8.TestParameters;
import com.android.tools.r8.TestParametersCollection;
import com.android.tools.r8.ToolHelper.DexVm.Version;
-import com.android.tools.r8.utils.AndroidApiLevel;
import com.android.tools.r8.utils.IntBox;
import com.android.tools.r8.utils.StringUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
+import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class SuppressedExceptionsTest extends TestBase {
- private final TestParameters parameters;
+ @Parameter(0)
+ public TestParameters parameters;
- @Parameterized.Parameters(name = "{0}")
+ @Parameters(name = "{0}")
public static TestParametersCollection data() {
return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
}
- public SuppressedExceptionsTest(TestParameters parameters) {
- this.parameters = parameters;
- }
-
public boolean runtimeHasSuppressedExceptionsSupport() {
// TODO(b/214239152): Update this if desugaring is changed.
// Despite 4.0.4 being API level 15 and add suppressed being officially added in 19 it is
@@ -43,10 +40,11 @@
|| parameters.getDexRuntimeVersion().isNewerThanOrEqual(Version.V4_0_4);
}
- public boolean apiLevelHasSuppressedExceptionsSupport() {
- return parameters
- .getApiLevel()
- .isGreaterThanOrEqualTo(apiLevelWithSuppressedExceptionsSupport());
+ public boolean apiLevelHasSuppressedExceptionsSupport(boolean isDesugaring) {
+ return !isDesugaring
+ || parameters
+ .getApiLevel()
+ .isGreaterThanOrEqualTo(apiLevelWithSuppressedExceptionsSupport());
}
@Test
@@ -62,7 +60,7 @@
hasInvokesTo(
inspector.clazz(TestClass.class).uniqueMethodWithOriginalName("main"),
"getSuppressed",
- apiLevelHasSuppressedExceptionsSupport() ? 1 : 0))
+ apiLevelHasSuppressedExceptionsSupport(true) ? 1 : 0))
.inspectIf(
DesugarTestConfiguration::isNotDesugared,
inspector ->
@@ -74,9 +72,7 @@
@Test
public void testR8() throws Exception {
- assumeTrue(
- "R8 does not desugar CF so only run the high API variant.",
- parameters.isDexRuntime() || parameters.getApiLevel().isGreaterThan(AndroidApiLevel.B));
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addInnerClasses(SuppressedExceptionsTest.class)
.setMinApi(parameters.getApiLevel())
@@ -89,7 +85,7 @@
hasInvokesTo(
inspector.clazz(TestClass.class).uniqueMethodWithOriginalName("main"),
"getSuppressed",
- apiLevelHasSuppressedExceptionsSupport() ? 1 : 0);
+ apiLevelHasSuppressedExceptionsSupport(parameters.isDexRuntime()) ? 1 : 0);
IntBox gets = new IntBox(0);
IntBox adds = new IntBox(0);
inspector.forAllClasses(
@@ -99,7 +95,7 @@
gets.increment(getInvokesTo(m, "getSuppressed").size());
adds.increment(getInvokesTo(m, "addSuppressed").size());
}));
- if (apiLevelHasSuppressedExceptionsSupport()) {
+ if (apiLevelHasSuppressedExceptionsSupport(parameters.isDexRuntime())) {
assertEquals(1, gets.get());
assertEquals(1, adds.get());
} else {
diff --git a/src/test/java/com/android/tools/r8/desugar/suppressedexceptions/TwrSuppressedExceptionsTest.java b/src/test/java/com/android/tools/r8/desugar/suppressedexceptions/TwrSuppressedExceptionsTest.java
index 8ff8ca2..3b216d1 100644
--- a/src/test/java/com/android/tools/r8/desugar/suppressedexceptions/TwrSuppressedExceptionsTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/suppressedexceptions/TwrSuppressedExceptionsTest.java
@@ -4,7 +4,6 @@
package com.android.tools.r8.desugar.suppressedexceptions;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assume.assumeTrue;
import com.android.tools.r8.DesugarTestConfiguration;
import com.android.tools.r8.TestBase;
@@ -13,7 +12,6 @@
import com.android.tools.r8.TestRuntime.CfVm;
import com.android.tools.r8.ToolHelper.DexVm.Version;
import com.android.tools.r8.examples.JavaExampleClassProxy;
-import com.android.tools.r8.utils.AndroidApiLevel;
import com.android.tools.r8.utils.IntBox;
import com.android.tools.r8.utils.StringUtils;
import com.android.tools.r8.utils.codeinspector.ClassSubject;
@@ -26,6 +24,8 @@
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
+import org.junit.runners.Parameterized.Parameter;
+import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
public class TwrSuppressedExceptionsTest extends TestBase {
@@ -34,9 +34,10 @@
private static final String EXAMPLE = "examplesJava9/" + PKG;
private final JavaExampleClassProxy MAIN = new JavaExampleClassProxy(EXAMPLE, PKG + ".TestClass");
- private final TestParameters parameters;
+ @Parameter(0)
+ public TestParameters parameters;
- @Parameterized.Parameters(name = "{0}")
+ @Parameters(name = "{0}")
public static TestParametersCollection data() {
return getTestParameters()
.withCfRuntimesStartingFromIncluding(CfVm.JDK9)
@@ -45,10 +46,6 @@
.build();
}
- public TwrSuppressedExceptionsTest(TestParameters parameters) {
- this.parameters = parameters;
- }
-
public boolean runtimeHasSuppressedExceptionsSupport() {
// TODO(b/214239152): Update this if desugaring is changed.
// Despite 4.0.4 being API level 15 and add suppressed being officially added in 19 it is
@@ -58,14 +55,16 @@
|| parameters.getDexRuntimeVersion().isNewerThanOrEqual(Version.V4_0_4);
}
- public boolean apiLevelHasSuppressedExceptionsSupport() {
- return parameters
- .getApiLevel()
- .isGreaterThanOrEqualTo(apiLevelWithSuppressedExceptionsSupport());
+ public boolean apiLevelHasSuppressedExceptionsSupport(boolean isDesugaring) {
+ return !isDesugaring
+ || parameters
+ .getApiLevel()
+ .isGreaterThanOrEqualTo(apiLevelWithSuppressedExceptionsSupport());
}
- public boolean apiLevelHasTwrCloseResourceSupport() {
- return parameters.getApiLevel().isGreaterThanOrEqualTo(apiLevelWithTwrCloseResourceSupport());
+ public boolean apiLevelHasTwrCloseResourceSupport(boolean isDesugaring) {
+ return !isDesugaring
+ || parameters.getApiLevel().isGreaterThanOrEqualTo(apiLevelWithTwrCloseResourceSupport());
}
public List<Path> getProgramInputs() {
@@ -86,8 +85,8 @@
hasInvokesTo(
clazz.uniqueMethodWithOriginalName("bar"),
"$closeResource",
- apiLevelHasTwrCloseResourceSupport() ? 4 : 0);
- if (apiLevelHasSuppressedExceptionsSupport()) {
+ apiLevelHasTwrCloseResourceSupport(true) ? 4 : 0);
+ if (apiLevelHasSuppressedExceptionsSupport(true)) {
hasInvokesTo(clazz.mainMethod(), "getSuppressed", 1);
} else {
inspector.forAllClasses(
@@ -110,9 +109,7 @@
@Test
public void testR8() throws Exception {
- assumeTrue(
- "R8 does not desugar CF so only run the high API variant.",
- parameters.isDexRuntime() || parameters.getApiLevel().isGreaterThan(AndroidApiLevel.B));
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramFiles(getProgramInputs())
.setMinApi(parameters.getApiLevel())
@@ -120,7 +117,7 @@
// TODO(b/214250388): Don't warn about AutoClosable in synthesized code.
.apply(
b -> {
- if (!parameters.isCfRuntime() && !apiLevelHasTwrCloseResourceSupport()) {
+ if (!apiLevelHasTwrCloseResourceSupport(parameters.isDexRuntime())) {
b.addDontWarn(AutoCloseable.class);
}
})
@@ -138,7 +135,7 @@
gets.increment(getInvokesTo(m, "getSuppressed").size());
adds.increment(getInvokesTo(m, "addSuppressed").size());
}));
- if (apiLevelHasSuppressedExceptionsSupport()) {
+ if (apiLevelHasSuppressedExceptionsSupport(parameters.isDexRuntime())) {
hasInvokesTo(inspector.clazz(MAIN.typeName()).mainMethod(), "getSuppressed", 1);
assertEquals(1, gets.get());
assertEquals(1, adds.get());
diff --git a/src/test/java/com/android/tools/r8/desugaring/interfacemethods/DefaultInterfaceMethodDesugaringWithPublicStaticResolutionInvokeVirtualTest.java b/src/test/java/com/android/tools/r8/desugaring/interfacemethods/DefaultInterfaceMethodDesugaringWithPublicStaticResolutionInvokeVirtualTest.java
index 2639a1f..ff4dff5 100644
--- a/src/test/java/com/android/tools/r8/desugaring/interfacemethods/DefaultInterfaceMethodDesugaringWithPublicStaticResolutionInvokeVirtualTest.java
+++ b/src/test/java/com/android/tools/r8/desugaring/interfacemethods/DefaultInterfaceMethodDesugaringWithPublicStaticResolutionInvokeVirtualTest.java
@@ -88,6 +88,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
checkResult(
testForR8(parameters.getBackend())
.addProgramClasses(getProgramClasses())
diff --git a/src/test/java/com/android/tools/r8/desugaring/interfacemethods/DefaultInterfaceMethodDesugaringWithPublicStaticResolutionOnClassTest.java b/src/test/java/com/android/tools/r8/desugaring/interfacemethods/DefaultInterfaceMethodDesugaringWithPublicStaticResolutionOnClassTest.java
index b5949f7..dc8102e 100644
--- a/src/test/java/com/android/tools/r8/desugaring/interfacemethods/DefaultInterfaceMethodDesugaringWithPublicStaticResolutionOnClassTest.java
+++ b/src/test/java/com/android/tools/r8/desugaring/interfacemethods/DefaultInterfaceMethodDesugaringWithPublicStaticResolutionOnClassTest.java
@@ -79,6 +79,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramClasses(getProgramClasses())
.addProgramClassFileData(getProgramClassData())
diff --git a/src/test/java/com/android/tools/r8/desugaring/interfacemethods/DefaultInterfaceMethodDesugaringWithPublicStaticResolutionTest.java b/src/test/java/com/android/tools/r8/desugaring/interfacemethods/DefaultInterfaceMethodDesugaringWithPublicStaticResolutionTest.java
index c442b75..a8d0803 100644
--- a/src/test/java/com/android/tools/r8/desugaring/interfacemethods/DefaultInterfaceMethodDesugaringWithPublicStaticResolutionTest.java
+++ b/src/test/java/com/android/tools/r8/desugaring/interfacemethods/DefaultInterfaceMethodDesugaringWithPublicStaticResolutionTest.java
@@ -72,6 +72,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramClasses(getProgramClasses())
.addProgramClassFileData(getProgramClassData())
diff --git a/src/test/java/com/android/tools/r8/desugaring/interfacemethods/InterfaceWithClinitAndNoStaticMethodReferencesTest.java b/src/test/java/com/android/tools/r8/desugaring/interfacemethods/InterfaceWithClinitAndNoStaticMethodReferencesTest.java
index 7589f8a..f8907d9 100644
--- a/src/test/java/com/android/tools/r8/desugaring/interfacemethods/InterfaceWithClinitAndNoStaticMethodReferencesTest.java
+++ b/src/test/java/com/android/tools/r8/desugaring/interfacemethods/InterfaceWithClinitAndNoStaticMethodReferencesTest.java
@@ -37,6 +37,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addInnerClasses(InterfaceWithClinitAndNoStaticMethodReferencesTest.class)
.addKeepMainRule(TestClass.class)
diff --git a/src/test/java/com/android/tools/r8/desugaring/interfacemethods/InterfaceWithClinitAndNoStaticMethodsTest.java b/src/test/java/com/android/tools/r8/desugaring/interfacemethods/InterfaceWithClinitAndNoStaticMethodsTest.java
index 414520f..c49856c1 100644
--- a/src/test/java/com/android/tools/r8/desugaring/interfacemethods/InterfaceWithClinitAndNoStaticMethodsTest.java
+++ b/src/test/java/com/android/tools/r8/desugaring/interfacemethods/InterfaceWithClinitAndNoStaticMethodsTest.java
@@ -37,6 +37,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addInnerClasses(InterfaceWithClinitAndNoStaticMethodsTest.class)
.addKeepMainRule(TestClass.class)
diff --git a/src/test/java/com/android/tools/r8/desugaring/interfacemethods/InvokeSuperInDefaultMethodResolvingToLibraryTest.java b/src/test/java/com/android/tools/r8/desugaring/interfacemethods/InvokeSuperInDefaultMethodResolvingToLibraryTest.java
index a753b6c..190d79e 100644
--- a/src/test/java/com/android/tools/r8/desugaring/interfacemethods/InvokeSuperInDefaultMethodResolvingToLibraryTest.java
+++ b/src/test/java/com/android/tools/r8/desugaring/interfacemethods/InvokeSuperInDefaultMethodResolvingToLibraryTest.java
@@ -85,6 +85,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addInnerClasses(getClass())
.addLibraryFiles(ToolHelper.getAndroidJar(AndroidApiLevel.T))
@@ -104,6 +105,7 @@
@Test
public void testR8WithApiLevelCheck() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addInnerClasses(getClass())
.addLibraryFiles(ToolHelper.getAndroidJar(AndroidApiLevel.T))
diff --git a/src/test/java/com/android/tools/r8/graph/genericsignature/FormalTypeParameterClassBoundPruneTest.java b/src/test/java/com/android/tools/r8/graph/genericsignature/FormalTypeParameterClassBoundPruneTest.java
index 1221f73..68e1518 100644
--- a/src/test/java/com/android/tools/r8/graph/genericsignature/FormalTypeParameterClassBoundPruneTest.java
+++ b/src/test/java/com/android/tools/r8/graph/genericsignature/FormalTypeParameterClassBoundPruneTest.java
@@ -79,6 +79,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramClassFileData(
transformer(Main.class).removeInnerClasses().transform(),
diff --git a/src/test/java/com/android/tools/r8/graph/invokevirtual/InvokeVirtualPrivateBaseWithDefaultDirectInvokeTest.java b/src/test/java/com/android/tools/r8/graph/invokevirtual/InvokeVirtualPrivateBaseWithDefaultDirectInvokeTest.java
index 9df5458..b217463 100644
--- a/src/test/java/com/android/tools/r8/graph/invokevirtual/InvokeVirtualPrivateBaseWithDefaultDirectInvokeTest.java
+++ b/src/test/java/com/android/tools/r8/graph/invokevirtual/InvokeVirtualPrivateBaseWithDefaultDirectInvokeTest.java
@@ -56,7 +56,7 @@
@Test
public void testR8() throws Exception {
- assumeTrue(parameters.isDexRuntime() || isDefaultCfParameters());
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addInnerClasses(getClass())
.addKeepMainRule(Main.class)
diff --git a/src/test/java/com/android/tools/r8/graph/invokevirtual/InvokeVirtualPrivateBaseWithDefaultTest.java b/src/test/java/com/android/tools/r8/graph/invokevirtual/InvokeVirtualPrivateBaseWithDefaultTest.java
index 698de1b..4e39f6f 100644
--- a/src/test/java/com/android/tools/r8/graph/invokevirtual/InvokeVirtualPrivateBaseWithDefaultTest.java
+++ b/src/test/java/com/android/tools/r8/graph/invokevirtual/InvokeVirtualPrivateBaseWithDefaultTest.java
@@ -55,6 +55,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addInnerClasses(getClass())
.addKeepMainRule(Main.class)
diff --git a/src/test/java/com/android/tools/r8/ir/optimize/membervaluepropagation/MemberValuePropagationOfNullValueTest.java b/src/test/java/com/android/tools/r8/ir/optimize/membervaluepropagation/MemberValuePropagationOfNullValueTest.java
index 6694924..8e7674c 100644
--- a/src/test/java/com/android/tools/r8/ir/optimize/membervaluepropagation/MemberValuePropagationOfNullValueTest.java
+++ b/src/test/java/com/android/tools/r8/ir/optimize/membervaluepropagation/MemberValuePropagationOfNullValueTest.java
@@ -30,6 +30,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramClasses(Main.class, A.class)
.setMinApi(parameters.getApiLevel())
diff --git a/src/test/java/com/android/tools/r8/java_language/pattern_matching_for_instenceof/PattternMatchingForInstanceOfTest.java b/src/test/java/com/android/tools/r8/java_language/pattern_matching_for_instenceof/PattternMatchingForInstanceOfTest.java
index b40cca0..c762605 100644
--- a/src/test/java/com/android/tools/r8/java_language/pattern_matching_for_instenceof/PattternMatchingForInstanceOfTest.java
+++ b/src/test/java/com/android/tools/r8/java_language/pattern_matching_for_instenceof/PattternMatchingForInstanceOfTest.java
@@ -56,6 +56,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
R8TestBuilder<?> builder =
testForR8(parameters.getBackend())
.addProgramFiles(JAR)
diff --git a/src/test/java/com/android/tools/r8/memberrebinding/MemberRebindingAmbiguousDispatchToLibraryTest.java b/src/test/java/com/android/tools/r8/memberrebinding/MemberRebindingAmbiguousDispatchToLibraryTest.java
index 81ac099..c6640f6 100644
--- a/src/test/java/com/android/tools/r8/memberrebinding/MemberRebindingAmbiguousDispatchToLibraryTest.java
+++ b/src/test/java/com/android/tools/r8/memberrebinding/MemberRebindingAmbiguousDispatchToLibraryTest.java
@@ -70,6 +70,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.apply(this::setupInput)
.setMinApi(parameters.getApiLevel())
diff --git a/src/test/java/com/android/tools/r8/naming/retrace/RetraceInlineeWithNullCheckFollowingImplicitReceiverNullCheckTest.java b/src/test/java/com/android/tools/r8/naming/retrace/RetraceInlineeWithNullCheckFollowingImplicitReceiverNullCheckTest.java
index 15f867f..ea357c5 100644
--- a/src/test/java/com/android/tools/r8/naming/retrace/RetraceInlineeWithNullCheckFollowingImplicitReceiverNullCheckTest.java
+++ b/src/test/java/com/android/tools/r8/naming/retrace/RetraceInlineeWithNullCheckFollowingImplicitReceiverNullCheckTest.java
@@ -49,6 +49,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addInnerClasses(getClass())
.addKeepMainRule(Caller.class)
diff --git a/src/test/java/com/android/tools/r8/naming/retrace/RetraceInlineeWithNullCheckInlinedTest.java b/src/test/java/com/android/tools/r8/naming/retrace/RetraceInlineeWithNullCheckInlinedTest.java
index 90552b3..17e67fd 100644
--- a/src/test/java/com/android/tools/r8/naming/retrace/RetraceInlineeWithNullCheckInlinedTest.java
+++ b/src/test/java/com/android/tools/r8/naming/retrace/RetraceInlineeWithNullCheckInlinedTest.java
@@ -53,6 +53,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addInnerClasses(getClass())
.addKeepMainRule(Caller.class)
diff --git a/src/test/java/com/android/tools/r8/naming/retrace/RetraceInlineeWithNullCheckSequenceTest.java b/src/test/java/com/android/tools/r8/naming/retrace/RetraceInlineeWithNullCheckSequenceTest.java
index 48379c5..bbc374b 100644
--- a/src/test/java/com/android/tools/r8/naming/retrace/RetraceInlineeWithNullCheckSequenceTest.java
+++ b/src/test/java/com/android/tools/r8/naming/retrace/RetraceInlineeWithNullCheckSequenceTest.java
@@ -43,6 +43,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addInnerClasses(getClass())
.addKeepMainRule(Caller.class)
diff --git a/src/test/java/com/android/tools/r8/naming/retrace/RetraceInlineeWithNullCheckTest.java b/src/test/java/com/android/tools/r8/naming/retrace/RetraceInlineeWithNullCheckTest.java
index 1a73766..5dac751 100644
--- a/src/test/java/com/android/tools/r8/naming/retrace/RetraceInlineeWithNullCheckTest.java
+++ b/src/test/java/com/android/tools/r8/naming/retrace/RetraceInlineeWithNullCheckTest.java
@@ -52,6 +52,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addInnerClasses(getClass())
.addKeepMainRule(Caller.class)
diff --git a/src/test/java/com/android/tools/r8/optimize/argumentpropagation/UpwardsInterfacePropagationToLibraryOrClasspathMethodTest.java b/src/test/java/com/android/tools/r8/optimize/argumentpropagation/UpwardsInterfacePropagationToLibraryOrClasspathMethodTest.java
index aa57ae6..685dcff 100644
--- a/src/test/java/com/android/tools/r8/optimize/argumentpropagation/UpwardsInterfacePropagationToLibraryOrClasspathMethodTest.java
+++ b/src/test/java/com/android/tools/r8/optimize/argumentpropagation/UpwardsInterfacePropagationToLibraryOrClasspathMethodTest.java
@@ -76,6 +76,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addLibraryFiles(ToolHelper.getAndroidJar(AndroidApiLevel.S))
.apply(
diff --git a/src/test/java/com/android/tools/r8/profile/art/completeness/ApiOutlineProfileRewritingTest.java b/src/test/java/com/android/tools/r8/profile/art/completeness/ApiOutlineProfileRewritingTest.java
index 599d9c9..308b4b6 100644
--- a/src/test/java/com/android/tools/r8/profile/art/completeness/ApiOutlineProfileRewritingTest.java
+++ b/src/test/java/com/android/tools/r8/profile/art/completeness/ApiOutlineProfileRewritingTest.java
@@ -71,6 +71,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramClasses(Main.class)
.addLibraryClasses(LibraryClass.class)
diff --git a/src/test/java/com/android/tools/r8/resolution/VirtualOverrideOfPrivateStaticMethodTest.java b/src/test/java/com/android/tools/r8/resolution/VirtualOverrideOfPrivateStaticMethodTest.java
index 4fbc7e7..1be10cd 100644
--- a/src/test/java/com/android/tools/r8/resolution/VirtualOverrideOfPrivateStaticMethodTest.java
+++ b/src/test/java/com/android/tools/r8/resolution/VirtualOverrideOfPrivateStaticMethodTest.java
@@ -121,6 +121,7 @@
@Test
public void testR8() throws ExecutionException, CompilationFailedException, IOException {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramClasses(CLASSES)
.addKeepMainRule(Main.class)
diff --git a/src/test/java/com/android/tools/r8/retrace/RetraceLambdaTest.java b/src/test/java/com/android/tools/r8/retrace/RetraceLambdaTest.java
index e7b884c..98d324c 100644
--- a/src/test/java/com/android/tools/r8/retrace/RetraceLambdaTest.java
+++ b/src/test/java/com/android/tools/r8/retrace/RetraceLambdaTest.java
@@ -70,6 +70,7 @@
@Test
public void testEverythingInlined() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addInnerClasses(getClass())
.addKeepMainRule(Main.class)
@@ -94,6 +95,7 @@
assumeTrue(
"Skip R8/CF for min-api > 1 (R8/CF does not desugar)",
parameters.isDexRuntime() || parameters.getApiLevel().isEqualTo(AndroidApiLevel.B));
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addInnerClasses(getClass())
.addKeepMainRule(Main.class)
diff --git a/src/test/java/com/android/tools/r8/rewrite/assertions/AssertionConfigurationAssertionHandlerMissingClassTest.java b/src/test/java/com/android/tools/r8/rewrite/assertions/AssertionConfigurationAssertionHandlerMissingClassTest.java
index 72057c3..a5d165c 100644
--- a/src/test/java/com/android/tools/r8/rewrite/assertions/AssertionConfigurationAssertionHandlerMissingClassTest.java
+++ b/src/test/java/com/android/tools/r8/rewrite/assertions/AssertionConfigurationAssertionHandlerMissingClassTest.java
@@ -71,6 +71,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramClasses(MAIN_CLASS)
.addKeepMainRule(MAIN_CLASS)
diff --git a/src/test/java/com/android/tools/r8/rewrite/assertions/AssertionConfigurationAssertionHandlerTestBase.java b/src/test/java/com/android/tools/r8/rewrite/assertions/AssertionConfigurationAssertionHandlerTestBase.java
index 0583b32..715fb7f 100644
--- a/src/test/java/com/android/tools/r8/rewrite/assertions/AssertionConfigurationAssertionHandlerTestBase.java
+++ b/src/test/java/com/android/tools/r8/rewrite/assertions/AssertionConfigurationAssertionHandlerTestBase.java
@@ -73,6 +73,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addProgramClasses(getAssertionHandlerClasses())
.addProgramClasses(getTestClasses())
diff --git a/src/test/java/com/android/tools/r8/shaking/assumenosideeffects/AssumenosideeffectsVisibleMethodsTest.java b/src/test/java/com/android/tools/r8/shaking/assumenosideeffects/AssumenosideeffectsVisibleMethodsTest.java
index 73151e0..003000c 100644
--- a/src/test/java/com/android/tools/r8/shaking/assumenosideeffects/AssumenosideeffectsVisibleMethodsTest.java
+++ b/src/test/java/com/android/tools/r8/shaking/assumenosideeffects/AssumenosideeffectsVisibleMethodsTest.java
@@ -150,6 +150,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addLibraryFiles(libJarPath)
.addLibraryFiles(ToolHelper.getFirstSupportedAndroidJar(parameters.getApiLevel()))
diff --git a/src/test/java/com/android/tools/r8/shaking/clinit/InterfaceInitializedByInvokeStaticOnSubInterfaceTest.java b/src/test/java/com/android/tools/r8/shaking/clinit/InterfaceInitializedByInvokeStaticOnSubInterfaceTest.java
index fe71482..fca1942 100644
--- a/src/test/java/com/android/tools/r8/shaking/clinit/InterfaceInitializedByInvokeStaticOnSubInterfaceTest.java
+++ b/src/test/java/com/android/tools/r8/shaking/clinit/InterfaceInitializedByInvokeStaticOnSubInterfaceTest.java
@@ -40,6 +40,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addInnerClasses(getClass())
.addKeepMainRule(TestClass.class)
diff --git a/src/test/java/com/android/tools/r8/shaking/clinit/InterfaceInitializedByInvokeStaticTest.java b/src/test/java/com/android/tools/r8/shaking/clinit/InterfaceInitializedByInvokeStaticTest.java
index 1931487..08df00b 100644
--- a/src/test/java/com/android/tools/r8/shaking/clinit/InterfaceInitializedByInvokeStaticTest.java
+++ b/src/test/java/com/android/tools/r8/shaking/clinit/InterfaceInitializedByInvokeStaticTest.java
@@ -40,6 +40,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeR8TestParameters();
testForR8(parameters.getBackend())
.addInnerClasses(getClass())
.addKeepMainRule(TestClass.class)