Enable R8 partial for all non-examples desugaring tests
Bug: b/414327631
Change-Id: Ic5d9472847b58e9e18e16e7bf61782ed2f12225d
diff --git a/src/test/examplesJava9/twr/twraddsuppressed/TwrSuppressedExceptionsTest.java b/src/test/examplesJava9/twr/twraddsuppressed/TwrSuppressedExceptionsTest.java
index 7efe94e..8e75a8d 100644
--- a/src/test/examplesJava9/twr/twraddsuppressed/TwrSuppressedExceptionsTest.java
+++ b/src/test/examplesJava9/twr/twraddsuppressed/TwrSuppressedExceptionsTest.java
@@ -43,6 +43,7 @@
.withCfRuntimesStartingFromIncluding(CfVm.JDK9)
.withDexRuntimes()
.withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
.build();
}
@@ -112,6 +113,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addProgramClassFileData(getProgramInputs())
.setMinApi(parameters)
diff --git a/src/test/java/com/android/tools/r8/SupportedClassFileVersions.java b/src/test/java/com/android/tools/r8/SupportedClassFileVersionsTest.java
similarity index 91%
rename from src/test/java/com/android/tools/r8/SupportedClassFileVersions.java
rename to src/test/java/com/android/tools/r8/SupportedClassFileVersionsTest.java
index 3337d78..bcc2bce 100644
--- a/src/test/java/com/android/tools/r8/SupportedClassFileVersions.java
+++ b/src/test/java/com/android/tools/r8/SupportedClassFileVersionsTest.java
@@ -16,7 +16,7 @@
import org.objectweb.asm.Opcodes;
@RunWith(Parameterized.class)
-public class SupportedClassFileVersions extends TestBase implements Opcodes {
+public class SupportedClassFileVersionsTest extends TestBase implements Opcodes {
@Parameter(0)
public TestParameters parameters;
@@ -27,7 +27,12 @@
@Parameters(name = "{0}, CF version = {1}")
public static List<Object[]> data() {
return buildParameters(
- getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build(), CfVersion.all());
+ getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build(),
+ CfVersion.all());
}
@Test
@@ -46,6 +51,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addProgramClassFileData(dump(version))
.addKeepMainRule("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 89bc323..a0af340 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
@@ -23,7 +23,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
private static final String EXPECTED_OUTPUT =
@@ -40,6 +44,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addInnerClasses(getClass())
.addKeepMainRule(TestClass.class)
diff --git a/src/test/java/com/android/tools/r8/code/invokedynamic/InvokeDynamicVirtualDispatchToDefaultInterfaceMethodTest.java b/src/test/java/com/android/tools/r8/code/invokedynamic/InvokeDynamicVirtualDispatchToDefaultInterfaceMethodTest.java
index c8291eb..3b592bd 100644
--- a/src/test/java/com/android/tools/r8/code/invokedynamic/InvokeDynamicVirtualDispatchToDefaultInterfaceMethodTest.java
+++ b/src/test/java/com/android/tools/r8/code/invokedynamic/InvokeDynamicVirtualDispatchToDefaultInterfaceMethodTest.java
@@ -21,6 +21,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;
import org.objectweb.asm.Handle;
import org.objectweb.asm.Opcodes;
@@ -34,23 +36,21 @@
@RunWith(Parameterized.class)
public class InvokeDynamicVirtualDispatchToDefaultInterfaceMethodTest extends TestBase {
- static final String EXPECTED = StringUtils.lines("Called I.foo");
+ private static final String EXPECTED = StringUtils.lines("Called I.foo");
- private final TestParameters parameters;
+ @Parameter(0)
+ public TestParameters parameters;
- @Parameterized.Parameters(name = "{0}")
+ @Parameters(name = "{0}")
public static TestParametersCollection data() {
return getTestParameters()
.withAllRuntimes()
.withApiLevelsStartingAtIncluding(apiLevelWithInvokeCustomSupport())
.enableApiLevelsForCf()
+ .withPartialCompilation()
.build();
}
- public InvokeDynamicVirtualDispatchToDefaultInterfaceMethodTest(TestParameters parameters) {
- this.parameters = parameters;
- }
-
@Test
public void testReference() throws Exception {
testForDesugaring(parameters)
@@ -65,6 +65,7 @@
assumeTrue(
"Only test one R8/CF build.",
parameters.isDexRuntime() || parameters.getApiLevel() == apiLevelWithInvokeCustomSupport());
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.allowAccessModification()
.addProgramClasses(I.class, A.class)
diff --git a/src/test/java/com/android/tools/r8/desugar/ConcurrentHashMapKeySetTest.java b/src/test/java/com/android/tools/r8/desugar/ConcurrentHashMapKeySetTest.java
index dda9269..6d9aac9 100644
--- a/src/test/java/com/android/tools/r8/desugar/ConcurrentHashMapKeySetTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/ConcurrentHashMapKeySetTest.java
@@ -13,21 +13,24 @@
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 ConcurrentHashMapKeySetTest extends TestBase {
- static final String EXPECTED = StringUtils.lines("Hello, world");
+ private static final String EXPECTED = StringUtils.lines("Hello, world");
- 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 ConcurrentHashMapKeySetTest(TestParameters parameters) {
- this.parameters = parameters;
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
@Test
diff --git a/src/test/java/com/android/tools/r8/desugar/DesugarInnerClassesInInterfaces.java b/src/test/java/com/android/tools/r8/desugar/DesugarInnerClassesInInterfacesTest.java
similarity index 90%
rename from src/test/java/com/android/tools/r8/desugar/DesugarInnerClassesInInterfaces.java
rename to src/test/java/com/android/tools/r8/desugar/DesugarInnerClassesInInterfacesTest.java
index 88a21c8..498db5c 100644
--- a/src/test/java/com/android/tools/r8/desugar/DesugarInnerClassesInInterfaces.java
+++ b/src/test/java/com/android/tools/r8/desugar/DesugarInnerClassesInInterfacesTest.java
@@ -15,10 +15,11 @@
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 DesugarInnerClassesInInterfaces extends TestBase {
+public class DesugarInnerClassesInInterfacesTest extends TestBase {
private final List<String> EXPECTED_RESULT_WITHOUT_DESUGARING =
ImmutableList.of(
@@ -33,19 +34,20 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
- private final TestParameters parameters;
-
- public DesugarInnerClassesInInterfaces(TestParameters parameters) {
- this.parameters = parameters;
- }
+ @Parameter(0)
+ public TestParameters parameters;
@Test
public void testDesugar() throws Exception {
testForDesugaring(parameters)
- .addInnerClasses(DesugarInnerClassesInInterfaces.class)
+ .addInnerClasses(getClass())
.run(parameters.getRuntime(), TestClass.class)
.applyIf(
DesugarTestConfiguration::isNotDesugared,
@@ -64,8 +66,9 @@
@Test
public void testR8Compat() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8Compat(parameters.getBackend())
- .addInnerClasses(DesugarInnerClassesInInterfaces.class)
+ .addInnerClasses(getClass())
.setMinApi(parameters)
.addKeepAllClassesRule()
.addKeepAttributeInnerClassesAndEnclosingMethod()
@@ -81,8 +84,9 @@
@Test
public void testR8Full() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
- .addInnerClasses(DesugarInnerClassesInInterfaces.class)
+ .addInnerClasses(getClass())
.setMinApi(parameters)
.addKeepAllClassesRule()
.addKeepAttributeInnerClassesAndEnclosingMethod()
diff --git a/src/test/java/com/android/tools/r8/desugar/DesugarLambdaDontPublicize.java b/src/test/java/com/android/tools/r8/desugar/DesugarLambdaDontPublicizeTest.java
similarity index 82%
rename from src/test/java/com/android/tools/r8/desugar/DesugarLambdaDontPublicize.java
rename to src/test/java/com/android/tools/r8/desugar/DesugarLambdaDontPublicizeTest.java
index cc9d06b..67b9c7b 100644
--- a/src/test/java/com/android/tools/r8/desugar/DesugarLambdaDontPublicize.java
+++ b/src/test/java/com/android/tools/r8/desugar/DesugarLambdaDontPublicizeTest.java
@@ -15,25 +15,28 @@
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 DesugarLambdaDontPublicize extends TestBase {
+public class DesugarLambdaDontPublicizeTest extends TestBase {
- @Parameterized.Parameters(name = "{0}")
+ @Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
- private final TestParameters parameters;
-
- public DesugarLambdaDontPublicize(TestParameters parameters) {
- this.parameters = parameters;
- }
+ @Parameter(0)
+ public TestParameters parameters;
@Test
public void testDesugar() throws Exception {
testForDesugaring(parameters)
- .addInnerClasses(DesugarLambdaDontPublicize.class)
+ .addInnerClasses(DesugarLambdaDontPublicizeTest.class)
.run(parameters.getRuntime(), TestClass.class)
.assertSuccessWithOutputLines("foobar")
.inspectIf(
diff --git a/src/test/java/com/android/tools/r8/desugar/DesugarLambdaWithAnonymousClass.java b/src/test/java/com/android/tools/r8/desugar/DesugarLambdaWithAnonymousClassTest.java
similarity index 90%
rename from src/test/java/com/android/tools/r8/desugar/DesugarLambdaWithAnonymousClass.java
rename to src/test/java/com/android/tools/r8/desugar/DesugarLambdaWithAnonymousClassTest.java
index 2e1e23a..23f089b 100644
--- a/src/test/java/com/android/tools/r8/desugar/DesugarLambdaWithAnonymousClass.java
+++ b/src/test/java/com/android/tools/r8/desugar/DesugarLambdaWithAnonymousClassTest.java
@@ -29,7 +29,7 @@
import org.junit.runners.Parameterized.Parameters;
@RunWith(Parameterized.class)
-public class DesugarLambdaWithAnonymousClass extends TestBase {
+public class DesugarLambdaWithAnonymousClassTest extends TestBase {
private final List<String> EXPECTED_JAVAC_RESULT =
ImmutableList.of("Hello from inside lambda$test$0", "Hello from inside lambda$testStatic$1");
@@ -37,12 +37,16 @@
private final List<String> EXPECTED_D8_DESUGARED_RESULT =
ImmutableList.of(
"Hello from inside"
- + " lambda$test$0$com-android-tools-r8-desugar-DesugarLambdaWithAnonymousClass$TestClass",
+ + " lambda$test$0$com-android-tools-r8-desugar-DesugarLambdaWithAnonymousClassTest$TestClass",
"Hello from inside lambda$testStatic$1");
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
@Parameter(0)
@@ -70,7 +74,7 @@
assertTrue(clazz.isAnonymousClass());
DexMethod enclosingMethod = clazz.getFinalEnclosingMethod();
ClassSubject testClassSubject =
- inspector.clazz(DesugarLambdaWithAnonymousClass.TestClass.class);
+ inspector.clazz(DesugarLambdaWithAnonymousClassTest.TestClass.class);
assertEquals(
testClassSubject, inspector.clazz(enclosingMethod.holder.toSourceString()));
assertThat(
@@ -85,8 +89,8 @@
public static void checkExpectedJavacNames() throws Exception {
CodeInspector inspector =
new CodeInspector(
- ToolHelper.getClassFilesForInnerClasses(DesugarLambdaWithAnonymousClass.class));
- String outer = DesugarLambdaWithAnonymousClass.class.getTypeName();
+ ToolHelper.getClassFilesForInnerClasses(DesugarLambdaWithAnonymousClassTest.class));
+ String outer = DesugarLambdaWithAnonymousClassTest.class.getTypeName();
ClassSubject testClass = inspector.clazz(outer + "$TestClass");
assertThat(testClass, isPresent());
assertThat(testClass.uniqueMethodWithOriginalName("lambda$test$0"), isPresent());
@@ -98,7 +102,7 @@
@Test
public void testDesugar() throws Exception {
testForDesugaring(parameters)
- .addInnerClasses(DesugarLambdaWithAnonymousClass.class)
+ .addInnerClasses(DesugarLambdaWithAnonymousClassTest.class)
.run(parameters.getRuntime(), TestClass.class)
.inspect(this::checkEnclosingMethod)
.applyIf(
@@ -112,9 +116,10 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
try {
testForR8(parameters.getBackend())
- .addInnerClasses(DesugarLambdaWithAnonymousClass.class)
+ .addInnerClasses(DesugarLambdaWithAnonymousClassTest.class)
.setMinApi(parameters)
// Keep the synthesized inner classes.
.addKeepRules("-keep class **.*$TestClass$1")
diff --git a/src/test/java/com/android/tools/r8/desugar/DesugarLambdaWithLocalClass.java b/src/test/java/com/android/tools/r8/desugar/DesugarLambdaWithLocalClassTest.java
similarity index 87%
rename from src/test/java/com/android/tools/r8/desugar/DesugarLambdaWithLocalClass.java
rename to src/test/java/com/android/tools/r8/desugar/DesugarLambdaWithLocalClassTest.java
index 517288b..4d50d6a 100644
--- a/src/test/java/com/android/tools/r8/desugar/DesugarLambdaWithLocalClass.java
+++ b/src/test/java/com/android/tools/r8/desugar/DesugarLambdaWithLocalClassTest.java
@@ -24,29 +24,32 @@
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 DesugarLambdaWithLocalClass extends TestBase {
+public class DesugarLambdaWithLocalClassTest extends TestBase {
- private List<String> EXPECTED_JAVAC_RESULT =
+ private static final List<String> EXPECTED_JAVAC_RESULT =
ImmutableList.of("Hello from inside lambda$test$0", "Hello from inside lambda$testStatic$1");
- private List<String> EXPECTED_D8_DESUGARED_RESULT =
+ private static final List<String> EXPECTED_D8_DESUGARED_RESULT =
ImmutableList.of(
"Hello from inside"
- + " lambda$test$0$com-android-tools-r8-desugar-DesugarLambdaWithLocalClass$TestClass",
+ + " lambda$test$0$com-android-tools-r8-desugar-DesugarLambdaWithLocalClassTest$TestClass",
"Hello from inside lambda$testStatic$1");
- @Parameterized.Parameters(name = "{0}")
+ @Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
- private final TestParameters parameters;
-
- public DesugarLambdaWithLocalClass(TestParameters parameters) {
- this.parameters = parameters;
- }
+ @Parameter(0)
+ public TestParameters parameters;
static class Counter {
private int count = 0;
@@ -84,8 +87,8 @@
public static void checkExpectedJavacNames() throws Exception {
CodeInspector inspector =
new CodeInspector(
- ToolHelper.getClassFilesForInnerClasses(DesugarLambdaWithLocalClass.class));
- String outer = DesugarLambdaWithLocalClass.class.getTypeName();
+ ToolHelper.getClassFilesForInnerClasses(DesugarLambdaWithLocalClassTest.class));
+ String outer = DesugarLambdaWithLocalClassTest.class.getTypeName();
ClassSubject testClass = inspector.clazz(outer + "$TestClass");
assertThat(testClass, isPresent());
assertThat(testClass.uniqueMethodWithOriginalName("lambda$test$0"), isPresent());
@@ -97,7 +100,7 @@
@Test
public void testDesugar() throws Exception {
testForDesugaring(parameters)
- .addInnerClasses(DesugarLambdaWithLocalClass.class)
+ .addInnerClasses(DesugarLambdaWithLocalClassTest.class)
.run(parameters.getRuntime(), TestClass.class)
.inspect(this::checkEnclosingMethod)
.applyIf(
@@ -111,8 +114,9 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
- .addInnerClasses(DesugarLambdaWithLocalClass.class)
+ .addInnerClasses(DesugarLambdaWithLocalClassTest.class)
.setMinApi(parameters)
// Keep the synthesized inner classes.
.addKeepRules("-keep class **.*$TestClass$*MyConsumerImpl")
diff --git a/src/test/java/com/android/tools/r8/desugar/DesugarToClassFileBackport.java b/src/test/java/com/android/tools/r8/desugar/DesugarToClassFileBackportTest.java
similarity index 90%
rename from src/test/java/com/android/tools/r8/desugar/DesugarToClassFileBackport.java
rename to src/test/java/com/android/tools/r8/desugar/DesugarToClassFileBackportTest.java
index b1fae08..5a71507 100644
--- a/src/test/java/com/android/tools/r8/desugar/DesugarToClassFileBackport.java
+++ b/src/test/java/com/android/tools/r8/desugar/DesugarToClassFileBackportTest.java
@@ -26,20 +26,23 @@
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 DesugarToClassFileBackport extends TestBase {
+public class DesugarToClassFileBackportTest extends TestBase {
- @Parameterized.Parameters(name = "{0}")
+ @Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
- private final TestParameters parameters;
-
- public DesugarToClassFileBackport(TestParameters parameters) {
- this.parameters = parameters;
- }
+ @Parameter(0)
+ public TestParameters parameters;
private boolean isCfLAdd(CfInstruction instruction) {
return (instruction instanceof CfArithmeticBinop)
@@ -97,7 +100,7 @@
@Test
public void test() throws Exception {
testForDesugaring(parameters)
- .addInnerClasses(DesugarToClassFileBackport.class)
+ .addInnerClasses(DesugarToClassFileBackportTest.class)
.run(parameters.getRuntime(), TestClass.class)
.inspectIf(DesugarTestConfiguration::isNotDesugared, this::checkBackportingNotRequired)
.inspectIf(DesugarTestConfiguration::isDesugared, this::checkBackportedIfRequired)
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 d0c79d7..f44bb59 100644
--- a/src/test/java/com/android/tools/r8/desugar/InterfaceInvokePrivateTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/InterfaceInvokePrivateTest.java
@@ -4,7 +4,6 @@
package com.android.tools.r8.desugar;
import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assume.assumeTrue;
import com.android.tools.r8.DesugarTestConfiguration;
import com.android.tools.r8.TestBase;
@@ -18,6 +17,7 @@
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
import org.junit.runners.Parameterized.Parameter;
+import org.junit.runners.Parameterized.Parameters;
import org.objectweb.asm.Opcodes;
@RunWith(Parameterized.class)
@@ -29,10 +29,15 @@
@Parameter(1)
public CfVersion inputCfVersion;
- @Parameterized.Parameters(name = "{0}, Input CfVersion = {1})")
+ @Parameters(name = "{0}, Input CfVersion = {1})")
public static Iterable<?> data() {
return buildParameters(
- getTestParameters().withCfRuntimes().withDexRuntimes().withAllApiLevelsAlsoForCf().build(),
+ getTestParameters()
+ .withCfRuntimes()
+ .withDexRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build(),
CfVersion.rangeInclusive(CfVersion.V1_8, CfVersion.V15));
}
@@ -45,9 +50,7 @@
@Test
public void testReference() throws Exception {
- assumeTrue(parameters.getRuntime().isCf());
- assumeTrue(parameters.getApiLevel().isEqualTo(AndroidApiLevel.B));
-
+ parameters.assumeJvmTestParameters();
testForJvm(parameters)
.addProgramClassFileData(transformIToPrivate(inputCfVersion))
.addProgramClasses(TestRunner.class)
@@ -101,6 +104,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addProgramClassFileData(transformIToPrivate(inputCfVersion))
.addProgramClasses(TestRunner.class)
diff --git a/src/test/java/com/android/tools/r8/desugar/MissingBridgeTest.java b/src/test/java/com/android/tools/r8/desugar/MissingBridgeTest.java
index e02104d..9f7272e 100644
--- a/src/test/java/com/android/tools/r8/desugar/MissingBridgeTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/MissingBridgeTest.java
@@ -15,6 +15,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 MissingBridgeTest extends TestBase {
@@ -22,21 +24,23 @@
static final String EXPECTED_WITH_BRIDGE = StringUtils.lines("null", "non-null");
static final String EXPECTED_WITHOUT_BRIDGE = StringUtils.lines("null", "null");
- private final TestParameters parameters;
- private final boolean withBridge;
+ @Parameter(0)
+ public TestParameters parameters;
- @Parameterized.Parameters(name = "{0}, bridge:{1}")
+ @Parameter(1)
+ public boolean withBridge;
+
+ @Parameters(name = "{0}, bridge:{1}")
public static List<Object[]> data() {
return buildParameters(
- getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build(),
+ getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build(),
BooleanUtils.values());
}
- public MissingBridgeTest(TestParameters parameters, boolean withBridge) {
- this.parameters = parameters;
- this.withBridge = withBridge;
- }
-
private String getExpected() {
return withBridge ? EXPECTED_WITH_BRIDGE : EXPECTED_WITHOUT_BRIDGE;
}
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 0ea0554..9146b3e 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
@@ -32,7 +32,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
private static final String EXPECTED_OUTPUT = StringUtils.lines("true", "true");
@@ -50,6 +54,8 @@
@Test
public void testDesugaring() throws Exception {
+ // TODO(b/414327631): Fixme.
+ parameters.assumeNoPartialCompilation();
testForDesugaring(parameters)
.addProgramClassFileData(getTransformedClasses())
.run(parameters.getRuntime(), MAIN_CLASS)
@@ -71,6 +77,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
.setMinApi(parameters)
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 5561be9..b1090e2 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
@@ -29,7 +29,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
private static final Class<?> MAIN_CLASS = A.class;
@@ -68,6 +72,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
.setMinApi(parameters)
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 181805b..34a8b71 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
@@ -30,7 +30,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
private static final Class<?> MAIN_CLASS = A.class;
@@ -67,6 +71,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
.setMinApi(parameters)
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 8aed1cc..28fa4d6 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
@@ -30,7 +30,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
private static final Class<?> MAIN_CLASS = A.class;
@@ -67,6 +71,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
.setMinApi(parameters)
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 b99aea1..41e90c1 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
@@ -30,7 +30,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
private static final String EXPECTED_OUTPUT_WITH_METHOD_HANDLES =
@@ -66,6 +70,8 @@
@Test
public void testDesugaring() throws Exception {
+ // TODO(b/414327631): Fixme.
+ parameters.assumeNoPartialCompilation();
testForDesugaring(parameters)
.addProgramClassFileData(getTransformedClasses())
.run(parameters.getRuntime(), MAIN_CLASS)
@@ -90,6 +96,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeDexRuntime();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
.setMinApi(parameters)
@@ -104,6 +111,7 @@
@Test
public void testR8KeepBootstrapMethod() throws Exception {
parameters.assumeDexRuntime();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
.setMinApi(parameters)
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 56ff5fa..bcb3e8e 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
@@ -29,7 +29,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
private static final Class<?> MAIN_CLASS = A.class;
@@ -70,6 +74,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
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 8ba066c..b63dc47 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
@@ -31,7 +31,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
private static final String EXPECTED_OUTPUT = StringUtils.lines("true", "true");
@@ -50,6 +54,8 @@
@Test
public void testDesugaring() throws Exception {
+ // TODO(b/414327631): Fixme.
+ parameters.assumeNoPartialCompilation();
testForDesugaring(parameters)
.addProgramClasses(MAIN_CLASS)
.addProgramClassFileData(getTransformedClasses())
@@ -72,6 +78,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addProgramClasses(MAIN_CLASS)
.addProgramClassFileData(getTransformedClasses())
diff --git a/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicMultipleConstantsUsingSameSymbolicReferenceTest.java b/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicMultipleConstantsUsingSameSymbolicReferenceTest.java
index 5ba0396..583f63f 100644
--- a/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicMultipleConstantsUsingSameSymbolicReferenceTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicMultipleConstantsUsingSameSymbolicReferenceTest.java
@@ -32,7 +32,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
private static final Class<?> MAIN_CLASS = Main.class;
@@ -51,6 +55,8 @@
@Test
public void testDesugaring() throws Exception {
+ // TODO(b/414327631): Fixme.
+ parameters.assumeNoPartialCompilation();
testForDesugaring(parameters)
.addProgramClassFileData(getTransformedClasses())
.addProgramClasses(Main.class)
@@ -73,6 +79,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
.addProgramClasses(Main.class)
diff --git a/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicMultipleConstantsWithDifferentSymbolicReferenceUsingSameBSMAndArgumentsTest.java b/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicMultipleConstantsWithDifferentSymbolicReferenceUsingSameBSMAndArgumentsTest.java
index 3bf967d..6b63a17 100644
--- a/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicMultipleConstantsWithDifferentSymbolicReferenceUsingSameBSMAndArgumentsTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicMultipleConstantsWithDifferentSymbolicReferenceUsingSameBSMAndArgumentsTest.java
@@ -33,7 +33,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
private static final String MAIN_CLASS = "A";
@@ -52,6 +56,8 @@
@Test
public void testDesugaring() throws Exception {
+ // TODO(b/414327631): Fixme.
+ parameters.assumeNoPartialCompilation();
testForDesugaring(parameters)
.addProgramClassFileData(classFileData)
.run(parameters.getRuntime(), MAIN_CLASS)
@@ -73,6 +79,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addProgramClassFileData(classFileData)
.setMinApi(parameters)
diff --git a/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicRegress272346803Test.java b/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicRegress272346803Test.java
index bec0148..b9c1aaf 100644
--- a/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicRegress272346803Test.java
+++ b/src/test/java/com/android/tools/r8/desugar/constantdynamic/ConstantDynamicRegress272346803Test.java
@@ -34,7 +34,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
private static final Class<?> MAIN_CLASS = Main.class;
@@ -53,6 +57,8 @@
@Test
public void testDesugaring() throws Exception {
+ // TODO(b/414327631): Fixme.
+ parameters.assumeNoPartialCompilation();
testForDesugaring(parameters)
.addProgramClasses(Main.class)
.addProgramClassFileData(getTransformedClasses())
@@ -75,6 +81,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addProgramClasses(Main.class)
.addProgramClassFileData(getTransformedClasses())
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 2313586..eeae7ed 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
@@ -32,7 +32,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
private static final String EXPECTED_OUTPUT =
@@ -51,6 +55,8 @@
@Test
public void testDesugaring() throws Exception {
+ // TODO(b/414327631): Fixme.
+ parameters.assumeNoPartialCompilation();
testForDesugaring(parameters)
.addProgramClassFileData(getTransformedClasses())
.run(parameters.getRuntime(), MAIN_CLASS)
@@ -72,6 +78,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
.setMinApi(parameters)
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 a18cbdc..c88a149 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
@@ -33,7 +33,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
private static final String EXPECTED_OUTPUT =
@@ -42,10 +46,8 @@
@Test
public void testReference() throws Exception {
- assumeTrue(parameters.isCfRuntime());
+ parameters.assumeJvmTestParameters();
assumeTrue(parameters.getRuntime().asCf().isNewerThanOrEqual(CfVm.JDK11));
- assumeTrue(parameters.getApiLevel().isEqualTo(AndroidApiLevel.B));
-
testForJvm(parameters)
.addProgramClassFileData(getTransformedClasses())
.run(parameters.getRuntime(), MAIN_CLASS)
@@ -54,6 +56,8 @@
@Test
public void testDesugaring() throws Exception {
+ // TODO(b/414327631): Fixme.
+ parameters.assumeNoPartialCompilation();
testForDesugaring(parameters)
.addProgramClassFileData(getTransformedClasses())
.run(parameters.getRuntime(), MAIN_CLASS)
@@ -75,6 +79,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
.setMinApi(parameters)
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 b8e5757..d307e81 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
@@ -32,7 +32,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
private static final String EXPECTED_OUTPUT =
@@ -41,10 +45,8 @@
@Test
public void testReference() throws Exception {
- assumeTrue(parameters.isCfRuntime());
+ parameters.assumeJvmTestParameters();
assumeTrue(parameters.getRuntime().asCf().isNewerThanOrEqual(CfVm.JDK11));
- assumeTrue(parameters.getApiLevel().isEqualTo(AndroidApiLevel.B));
-
testForJvm(parameters)
.addProgramClassFileData(getTransformedClasses())
.run(parameters.getRuntime(), A.class)
@@ -53,6 +55,8 @@
@Test
public void testDesugaring() throws Exception {
+ // TODO(b/414327631): Fixme.
+ parameters.assumeNoPartialCompilation();
testForDesugaring(parameters)
.addProgramClassFileData(getTransformedClasses())
.run(parameters.getRuntime(), MAIN_CLASS)
@@ -74,6 +78,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addProgramClassFileData(getTransformedClasses())
.setMinApi(parameters)
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 7315807..b223563 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
@@ -12,6 +12,7 @@
import com.android.tools.r8.TestParameters;
import com.android.tools.r8.TestParametersCollection;
import com.android.tools.r8.synthesis.SyntheticItemsTestUtils;
+import com.android.tools.r8.utils.InternalOptions;
import com.android.tools.r8.utils.StringUtils;
import com.android.tools.r8.utils.codeinspector.CodeInspector;
import com.android.tools.r8.utils.codeinspector.InstructionSubject;
@@ -29,7 +30,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
private static final String EXPECTED_OUTPUT = StringUtils.lines("1", "2", "3", "4.0", "5");
@@ -81,12 +86,27 @@
@Test
public void testDesugaring() throws Exception {
- testForDesugaring(
- parameters,
- options -> {
- options.testing.alwaysGenerateLambdaFactoryMethods = true;
- })
+ testForDesugaring(parameters)
.addInnerClasses(getClass())
+ .forEach(
+ builder -> {
+ if (builder.isD8TestBuilder()) {
+ builder
+ .asD8TestBuilder()
+ .addOptionsModification(this::configureAlwaysGenerateLambdaFactoryMethods);
+ } else if (builder.isD8IntermediateTestBuilder()) {
+ builder
+ .asD8IntermediateTestBuilder()
+ .addOptionsModification(this::configureAlwaysGenerateLambdaFactoryMethods);
+ } else if (builder.isR8PartialTestBuilder()) {
+ builder
+ .asR8PartialTestBuilder()
+ .addR8PartialD8OptionsModification(
+ this::configureAlwaysGenerateLambdaFactoryMethods);
+ } else {
+ assert builder.isJvmTestBuilder();
+ }
+ })
.run(parameters.getRuntime(), TestClass.class)
.applyIf(
DesugarTestConfiguration::isDesugared,
@@ -107,9 +127,14 @@
.assertSuccessWithOutput(EXPECTED_OUTPUT);
}
+ private void configureAlwaysGenerateLambdaFactoryMethods(InternalOptions options) {
+ options.getTestingOptions().alwaysGenerateLambdaFactoryMethods = true;
+ }
+
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addInnerClasses(getClass())
.addKeepMainRule(TestClass.class)
diff --git a/src/test/java/com/android/tools/r8/desugar/lambdas/LambdasInHugeMethod.java b/src/test/java/com/android/tools/r8/desugar/lambdas/LambdasInHugeMethodTest.java
similarity index 94%
rename from src/test/java/com/android/tools/r8/desugar/lambdas/LambdasInHugeMethod.java
rename to src/test/java/com/android/tools/r8/desugar/lambdas/LambdasInHugeMethodTest.java
index c242996..020b1da 100644
--- a/src/test/java/com/android/tools/r8/desugar/lambdas/LambdasInHugeMethod.java
+++ b/src/test/java/com/android/tools/r8/desugar/lambdas/LambdasInHugeMethodTest.java
@@ -21,13 +21,17 @@
import org.objectweb.asm.Type;
@RunWith(Parameterized.class)
-public class LambdasInHugeMethod extends TestBase implements Opcodes {
+public class LambdasInHugeMethodTest extends TestBase implements Opcodes {
@Parameter() public TestParameters parameters;
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
// With 1311 the TestClass main method exceeds class file method size limit
@@ -68,6 +72,7 @@
@Test
public void testR8() throws Exception {
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addProgramClasses(MyConsumer.class, MyTriConsumer.class)
.addProgramClassFileData(generateTestClass())
@@ -140,7 +145,7 @@
Type.getType("()V"),
new Handle(
Opcodes.H_INVOKESTATIC,
- "com/android/tools/r8/desugar/lambdas/LambdasInHugeMethod$TestClass",
+ "com/android/tools/r8/desugar/lambdas/LambdasInHugeMethodTest$TestClass",
"greet",
"()V",
false),
@@ -160,7 +165,7 @@
methodVisitor.visitInsn(POP);
methodVisitor.visitInvokeDynamicInsn(
"create",
- "(Ljava/io/PrintStream;)Lcom/android/tools/r8/desugar/lambdas/LambdasInHugeMethod$MyConsumer;",
+ "(Ljava/io/PrintStream;)Lcom/android/tools/r8/desugar/lambdas/LambdasInHugeMethodTest$MyConsumer;",
new Handle(
Opcodes.H_INVOKESTATIC,
"java/lang/invoke/LambdaMetafactory",
@@ -179,13 +184,13 @@
});
methodVisitor.visitMethodInsn(
INVOKESTATIC,
- "com/android/tools/r8/desugar/lambdas/LambdasInHugeMethod$TestClass",
+ "com/android/tools/r8/desugar/lambdas/LambdasInHugeMethodTest$TestClass",
"greet",
- "(Lcom/android/tools/r8/desugar/lambdas/LambdasInHugeMethod$MyConsumer;)V",
+ "(Lcom/android/tools/r8/desugar/lambdas/LambdasInHugeMethodTest$MyConsumer;)V",
false);
methodVisitor.visitInvokeDynamicInsn(
"accept",
- "()Lcom/android/tools/r8/desugar/lambdas/LambdasInHugeMethod$MyTriConsumer;",
+ "()Lcom/android/tools/r8/desugar/lambdas/LambdasInHugeMethodTest$MyTriConsumer;",
new Handle(
Opcodes.H_INVOKESTATIC,
"java/lang/invoke/LambdaMetafactory",
@@ -196,7 +201,7 @@
Type.getType("(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V"),
new Handle(
Opcodes.H_INVOKESTATIC,
- "com/android/tools/r8/desugar/lambdas/LambdasInHugeMethod$TestClass",
+ "com/android/tools/r8/desugar/lambdas/LambdasInHugeMethodTest$TestClass",
"greetTri",
"(JDLjava/lang/String;)V",
false),
@@ -214,7 +219,7 @@
methodVisitor.visitLdcInsn("5");
methodVisitor.visitMethodInsn(
INVOKEINTERFACE,
- "com/android/tools/r8/desugar/lambdas/LambdasInHugeMethod$MyTriConsumer",
+ "com/android/tools/r8/desugar/lambdas/LambdasInHugeMethodTest$MyTriConsumer",
"accept",
"(Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Object;)V",
true);
diff --git a/src/test/java/com/android/tools/r8/desugar/staticinterfacemethod/InvokeStaticDesugarTest.java b/src/test/java/com/android/tools/r8/desugar/staticinterfacemethod/InvokeStaticDesugarTest.java
index 2472ac4..5c6c6cc 100644
--- a/src/test/java/com/android/tools/r8/desugar/staticinterfacemethod/InvokeStaticDesugarTest.java
+++ b/src/test/java/com/android/tools/r8/desugar/staticinterfacemethod/InvokeStaticDesugarTest.java
@@ -12,6 +12,7 @@
import static org.junit.Assume.assumeFalse;
import com.android.tools.r8.DesugarTestConfiguration;
+import com.android.tools.r8.PartialCompilationTestParameters;
import com.android.tools.r8.TestBase;
import com.android.tools.r8.TestParameters;
import com.android.tools.r8.TestRunResult;
@@ -30,27 +31,31 @@
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 InvokeStaticDesugarTest extends TestBase {
- private final TestParameters parameters;
- private final boolean intermediate;
- private final String EXPECTED = "Hello World!";
+ private static final String EXPECTED = "Hello World!";
+
+ @Parameter(0)
+ public TestParameters parameters;
+
+ @Parameter(1)
+ public boolean intermediate;
@Parameters(name = "{0}, intermediate in first step: {1}")
public static Collection<Object[]> data() {
return buildParameters(
- getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build(),
+ getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build(),
BooleanUtils.values());
}
- public InvokeStaticDesugarTest(TestParameters parameters, boolean intermediate) {
- this.parameters = parameters;
- this.intermediate = intermediate;
- }
-
@Test
public void testDesugar() throws Exception {
// Intermediate not used in this test.
@@ -74,11 +79,11 @@
public void testDoubleDesugar() throws Exception {
// Desugar using API level that cannot leave static interface invokes.
Path jar =
- testForD8(Backend.CF)
+ testForD8(Backend.CF, PartialCompilationTestParameters.NONE)
.addLibraryClasses(Library.class)
.addProgramClasses(Main.class)
.setMinApi(AndroidApiLevel.B)
- .setIntermediate(intermediate)
+ .apply(b -> b.asD8TestBuilder().setIntermediate(intermediate))
.compile()
.inspect(i -> assertEquals(1, getSyntheticMethods(i).size()))
.writeToZip();
@@ -126,14 +131,12 @@
return compileToZip(parameters, ImmutableList.of(), Library.class);
} else {
assert parameters.isDexRuntime();
- return testForD8(parameters.getBackend())
+ return testForD8(Backend.DEX, PartialCompilationTestParameters.NONE)
.addProgramClasses(Library.class)
.setMinApi(parameters)
.disableDesugaring()
.addOptionsModification(
- options -> {
- options.testing.allowStaticInterfaceMethodsForPreNApiLevel = true;
- })
+ options -> options.testing.allowStaticInterfaceMethodsForPreNApiLevel = true)
.compile()
.writeToZip();
}
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 f683135..f3d2e25 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
@@ -38,7 +38,11 @@
public static List<Object[]> data() {
return buildParameters(
BooleanUtils.values(),
- getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build());
+ getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build());
}
private void inspectRunResult(TestRunResult<?> runResult, boolean isDesugared) {
@@ -88,6 +92,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
assertFailsCompilationIf(
!allowInvokeErrors,
() ->
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 ba0f31f..4d9e7ea 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
@@ -30,7 +30,11 @@
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
public boolean runtimeHasSuppressedExceptionsSupport() {
@@ -50,7 +54,7 @@
}
@Test
- public void testD8() throws Exception {
+ public void testDesugaring() throws Exception {
testForDesugaring(parameters)
.addProgramClasses(TestClass.class)
.run(parameters.getRuntime(), TestClass.class)
@@ -75,6 +79,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addInnerClasses(SuppressedExceptionsTest.class)
.setMinApi(parameters)
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 7993c60..3fee496 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
@@ -10,25 +10,28 @@
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 InterfaceWithClinitAndNoStaticMethodReferencesTest extends TestBase {
static final String EXPECTED = StringUtils.lines("allocated A", "called A.m");
- private final TestParameters parameters;
+ @Parameter(0)
+ public TestParameters parameters;
- @Parameterized.Parameters(name = "{0}")
+ @Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimesAndApiLevels().withAllApiLevelsAlsoForCf().build();
- }
-
- public InterfaceWithClinitAndNoStaticMethodReferencesTest(TestParameters parameters) {
- this.parameters = parameters;
+ return getTestParameters()
+ .withAllRuntimesAndApiLevels()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
@Test
- public void testReference() throws Exception {
+ public void testDesugaring() throws Exception {
testForDesugaring(parameters)
.addInnerClasses(getClass())
.run(parameters.getRuntime(), TestClass.class)
@@ -38,6 +41,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
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 d49b731..26adc44 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
@@ -10,25 +10,28 @@
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 InterfaceWithClinitAndNoStaticMethodsTest extends TestBase {
static final String EXPECTED = StringUtils.lines("allocated A", "called A.m");
- private final TestParameters parameters;
+ @Parameter(0)
+ public TestParameters parameters;
- @Parameterized.Parameters(name = "{0}")
+ @Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimesAndApiLevels().withAllApiLevelsAlsoForCf().build();
- }
-
- public InterfaceWithClinitAndNoStaticMethodsTest(TestParameters parameters) {
- this.parameters = parameters;
+ return getTestParameters()
+ .withAllRuntimesAndApiLevels()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
@Test
- public void testReference() throws Exception {
+ public void testDesugaring() throws Exception {
testForDesugaring(parameters)
.addInnerClasses(getClass())
.run(parameters.getRuntime(), TestClass.class)
@@ -38,6 +41,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addInnerClasses(InterfaceWithClinitAndNoStaticMethodsTest.class)
.addKeepMainRule(TestClass.class)
diff --git a/src/test/java/com/android/tools/r8/desugaring/interfacemethods/ReturnTest.java b/src/test/java/com/android/tools/r8/desugaring/interfacemethods/ReturnTest.java
index 33e6587..ffda09e 100644
--- a/src/test/java/com/android/tools/r8/desugaring/interfacemethods/ReturnTest.java
+++ b/src/test/java/com/android/tools/r8/desugaring/interfacemethods/ReturnTest.java
@@ -11,20 +11,22 @@
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 ReturnTest extends TestBase {
- private final TestParameters parameters;
+ @Parameter(0)
+ public TestParameters parameters;
@Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build();
- }
-
- public ReturnTest(TestParameters parameters) {
- this.parameters = parameters;
+ return getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
@Test
diff --git a/src/test/java/com/android/tools/r8/desugaring/interfacemethods/StaticInterfaceMethodReferenceTest.java b/src/test/java/com/android/tools/r8/desugaring/interfacemethods/StaticInterfaceMethodReferenceTest.java
index e7fba9d..51c654e 100644
--- a/src/test/java/com/android/tools/r8/desugaring/interfacemethods/StaticInterfaceMethodReferenceTest.java
+++ b/src/test/java/com/android/tools/r8/desugaring/interfacemethods/StaticInterfaceMethodReferenceTest.java
@@ -6,6 +6,7 @@
import static org.junit.Assert.assertFalse;
import com.android.tools.r8.TestBase;
+import com.android.tools.r8.TestBuilderCollection;
import com.android.tools.r8.TestParameters;
import com.android.tools.r8.TestRunResult;
import com.android.tools.r8.TestRuntime.CfVm;
@@ -15,29 +16,33 @@
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 StaticInterfaceMethodReferenceTest extends TestBase {
- private final TestParameters parameters;
- private final boolean isInterface;
+ @Parameter(0)
+ public TestParameters parameters;
- @Parameterized.Parameters(name = "{0}, itf:{1}")
+ @Parameter(1)
+ public boolean isInterface;
+
+ @Parameters(name = "{0}, itf:{1}")
public static List<Object[]> data() {
return buildParameters(
- getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build(),
+ getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build(),
BooleanUtils.values());
}
- public StaticInterfaceMethodReferenceTest(TestParameters parameters, boolean isInterface) {
- this.parameters = parameters;
- this.isInterface = isInterface;
- }
-
@Test
public void test() throws Exception {
TestRunResult<?> result =
- testForDesugaring(parameters, o -> o.testing.allowInvokeErrors = true)
+ testForDesugaring(parameters)
.addProgramClasses(TestClass.class)
.addProgramClassFileData(getTarget(isInterface))
.run(parameters.getRuntime(), TestClass.class);
@@ -47,9 +52,13 @@
@Test
public void testTargetMissing() throws Exception {
TestRunResult<?> result =
- testForDesugaring(parameters, o -> o.testing.allowInvokeErrors = true)
+ testForDesugaring(parameters)
.addProgramClasses(TestClass.class)
.addRunClasspathFiles(buildOnDexRuntime(parameters, getTarget(isInterface)))
+ .applyIf(
+ parameters.getPartialCompilationTestParameters().isSome()
+ && !parameters.canUseDefaultAndStaticInterfaceMethods(),
+ TestBuilderCollection::allowDiagnosticWarningMessages)
.run(parameters.getRuntime(), TestClass.class);
// Missing target will cause the call to remain as Target::foo rather than Target$-CC::foo.
// TODO(b/166726895): Support static interface invoke as no knowledge of Target is needed.
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 32da7369..0bbae88 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
@@ -13,20 +13,23 @@
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 InterfaceInitializedByInvokeStaticOnSubInterfaceTest
extends ClassMayHaveInitializationSideEffectsTestBase {
- private final TestParameters parameters;
+ @Parameter(0)
+ public TestParameters parameters;
- @Parameterized.Parameters(name = "{0}")
+ @Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimesAndApiLevels().withAllApiLevelsAlsoForCf().build();
- }
-
- public InterfaceInitializedByInvokeStaticOnSubInterfaceTest(TestParameters parameters) {
- this.parameters = parameters;
+ return getTestParameters()
+ .withAllRuntimesAndApiLevels()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
@Test
@@ -40,6 +43,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addInnerClasses(getClass())
.addKeepMainRule(TestClass.class)
@@ -61,6 +65,7 @@
@Test
public void testClassInitializationMayHaveSideEffects() throws Exception {
+ parameters.assumeNoPartialCompilation();
AppView<AppInfoWithLiveness> appView =
computeAppViewWithLiveness(
buildInnerClasses(getClass())
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 d483632..0862dcf 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
@@ -13,24 +13,27 @@
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 InterfaceInitializedByInvokeStaticTest
extends ClassMayHaveInitializationSideEffectsTestBase {
- private final TestParameters parameters;
+ @Parameter(0)
+ public TestParameters parameters;
- @Parameterized.Parameters(name = "{0}")
+ @Parameters(name = "{0}")
public static TestParametersCollection data() {
- return getTestParameters().withAllRuntimesAndApiLevels().withAllApiLevelsAlsoForCf().build();
- }
-
- public InterfaceInitializedByInvokeStaticTest(TestParameters parameters) {
- this.parameters = parameters;
+ return getTestParameters()
+ .withAllRuntimesAndApiLevels()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build();
}
@Test
- public void testD8() throws Exception {
+ public void testDesugaring() throws Exception {
testForDesugaring(parameters)
.addInnerClasses(getClass())
.run(parameters.getRuntime(), TestClass.class)
@@ -40,6 +43,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addInnerClasses(getClass())
.addKeepMainRule(TestClass.class)
@@ -61,6 +65,7 @@
@Test
public void testClassInitializationMayHaveSideEffects() throws Exception {
+ parameters.assumeNoPartialCompilation();
AppView<AppInfoWithLiveness> appView =
computeAppViewWithLiveness(
buildInnerClasses(getClass())
diff --git a/src/test/java17/com/android/tools/r8/jdk17/backport/MathBackportJava17Test.java b/src/test/java17/com/android/tools/r8/jdk17/backport/MathBackportJava17Test.java
index f4d2522..8af1dfb 100644
--- a/src/test/java17/com/android/tools/r8/jdk17/backport/MathBackportJava17Test.java
+++ b/src/test/java17/com/android/tools/r8/jdk17/backport/MathBackportJava17Test.java
@@ -26,6 +26,7 @@
.withDexRuntimes()
.withCfRuntimesStartingFromIncluding(CfVm.JDK17)
.withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
.build();
}
diff --git a/src/test/java17/com/android/tools/r8/jdk17/backport/ObjectsBackportJava17Test.java b/src/test/java17/com/android/tools/r8/jdk17/backport/ObjectsBackportJava17Test.java
index bbff907..6ad1f9a 100644
--- a/src/test/java17/com/android/tools/r8/jdk17/backport/ObjectsBackportJava17Test.java
+++ b/src/test/java17/com/android/tools/r8/jdk17/backport/ObjectsBackportJava17Test.java
@@ -26,6 +26,7 @@
.withDexRuntimes()
.withCfRuntimesStartingFromIncluding(CfVm.JDK17)
.withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
.build();
}
diff --git a/src/test/java17/com/android/tools/r8/jdk17/backport/StrictMathBackportJava17Test.java b/src/test/java17/com/android/tools/r8/jdk17/backport/StrictMathBackportJava17Test.java
index 13c69ab..dc11819 100644
--- a/src/test/java17/com/android/tools/r8/jdk17/backport/StrictMathBackportJava17Test.java
+++ b/src/test/java17/com/android/tools/r8/jdk17/backport/StrictMathBackportJava17Test.java
@@ -25,6 +25,7 @@
.withDexRuntimes()
.withCfRuntimesStartingFromIncluding(CfVm.JDK17)
.withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
.build();
}
diff --git a/src/test/java17/com/android/tools/r8/jdk17/enum_sealed/SealedClassesEnumJdk17CompiledTest.java b/src/test/java17/com/android/tools/r8/jdk17/enum_sealed/SealedClassesEnumJdk17CompiledTest.java
index f131f91..a6d1aed 100644
--- a/src/test/java17/com/android/tools/r8/jdk17/enum_sealed/SealedClassesEnumJdk17CompiledTest.java
+++ b/src/test/java17/com/android/tools/r8/jdk17/enum_sealed/SealedClassesEnumJdk17CompiledTest.java
@@ -40,7 +40,11 @@
@Parameters(name = "{0}, keepPermittedSubclasses = {1}")
public static List<Object[]> data() {
return buildParameters(
- getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build(),
+ getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build(),
BooleanUtils.values());
}
@@ -84,6 +88,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addInnerClassesAndStrippedOuter(getClass())
.setMinApi(parameters)
diff --git a/src/test/java17/com/android/tools/r8/jdk17/lambda/LambdaJava17Test.java b/src/test/java17/com/android/tools/r8/jdk17/lambda/LambdaJava17Test.java
index 43fd2a7..f2a93ec 100644
--- a/src/test/java17/com/android/tools/r8/jdk17/lambda/LambdaJava17Test.java
+++ b/src/test/java17/com/android/tools/r8/jdk17/lambda/LambdaJava17Test.java
@@ -17,18 +17,16 @@
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 LambdaJava17Test extends TestBase {
- public LambdaJava17Test(TestParameters parameters) {
- this.parameters = parameters;
- }
-
private static final String EXPECTED_RESULT = "[abb, bbc]";
- private final TestParameters parameters;
+ @Parameter(0)
+ public TestParameters parameters;
@Parameters(name = "{0}")
public static TestParametersCollection data() {
@@ -36,6 +34,7 @@
.withCfRuntimesStartingFromIncluding(CfVm.JDK17)
.withDexRuntimes()
.withAllApiLevels()
+ .withPartialCompilation()
.enableApiLevelsForCf()
.build();
}
@@ -50,7 +49,7 @@
}
@Test
- public void testJavaD8() throws Exception {
+ public void testDesugaring() throws Exception {
testForDesugaring(parameters)
.addInnerClassesAndStrippedOuter(getClass())
.run(parameters.getRuntime(), Lambda.class)
@@ -60,6 +59,7 @@
@Test
public void testR8() throws Exception {
Assume.assumeTrue(parameters.isDexRuntime() || parameters.getApiLevel().equals(B));
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addInnerClassesAndStrippedOuter(getClass())
.applyIf(
diff --git a/src/test/java17/com/android/tools/r8/jdk17/sealed/SealedClassesJdk17CompiledTest.java b/src/test/java17/com/android/tools/r8/jdk17/sealed/SealedClassesJdk17CompiledTest.java
index 32b953e..e541dc4 100644
--- a/src/test/java17/com/android/tools/r8/jdk17/sealed/SealedClassesJdk17CompiledTest.java
+++ b/src/test/java17/com/android/tools/r8/jdk17/sealed/SealedClassesJdk17CompiledTest.java
@@ -40,7 +40,11 @@
@Parameters(name = "{0}, keepPermittedSubclasses = {1}")
public static List<Object[]> data() {
return buildParameters(
- getTestParameters().withAllRuntimes().withAllApiLevelsAlsoForCf().build(),
+ getTestParameters()
+ .withAllRuntimes()
+ .withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
+ .build(),
BooleanUtils.values());
}
@@ -86,6 +90,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
testForR8(parameters.getBackend())
.addProgramClassesAndInnerClasses(Helper.getSealedClasses())
.setMinApi(parameters)
diff --git a/src/test/java21/com/android/tools/r8/jdk21/jdk8272564/Jdk8272564InvalidCode.java b/src/test/java21/com/android/tools/r8/jdk21/jdk8272564/Jdk8272564InvalidCodeTest.java
similarity index 89%
rename from src/test/java21/com/android/tools/r8/jdk21/jdk8272564/Jdk8272564InvalidCode.java
rename to src/test/java21/com/android/tools/r8/jdk21/jdk8272564/Jdk8272564InvalidCodeTest.java
index ba91e60..6b665a4 100644
--- a/src/test/java21/com/android/tools/r8/jdk21/jdk8272564/Jdk8272564InvalidCode.java
+++ b/src/test/java21/com/android/tools/r8/jdk21/jdk8272564/Jdk8272564InvalidCodeTest.java
@@ -4,14 +4,11 @@
package com.android.tools.r8.jdk21.jdk8272564;
-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.TestRuntime.CfVm;
import com.android.tools.r8.ToolHelper.DexVm.Version;
-import com.android.tools.r8.utils.AndroidApiLevel;
import com.android.tools.r8.utils.DescriptorUtils;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -21,7 +18,7 @@
import org.objectweb.asm.Opcodes;
@RunWith(Parameterized.class)
-public class Jdk8272564InvalidCode extends TestBase {
+public class Jdk8272564InvalidCodeTest extends TestBase {
@Parameters(name = "{0}")
public static TestParametersCollection data() {
@@ -29,19 +26,16 @@
.withCfRuntimesStartingFromIncluding(CfVm.JDK21)
.withDexRuntimes()
.withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
.build();
}
@Parameter(0)
public TestParameters parameters;
- private boolean isDefaultCfParameters() {
- return parameters.isCfRuntime() && parameters.getApiLevel().equals(AndroidApiLevel.B);
- }
-
@Test
public void testRuntime() throws Exception {
- assumeTrue(isDefaultCfParameters());
+ parameters.assumeJvmTestParameters();
testForJvm(parameters)
.addProgramClasses(I.class)
.addProgramClassFileData(getTransformedClass())
@@ -51,7 +45,6 @@
@Test
public void testDesugaring() throws Exception {
- assumeTrue(parameters.isDexRuntime() || isDefaultCfParameters());
testForDesugaring(parameters)
.addStrippedOuter(getClass())
.addProgramClasses(I.class)
@@ -67,6 +60,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
// The R8 lens code rewriter rewrites to the code prior to fixing JDK-8272564.
testForR8(parameters.getBackend())
.addStrippedOuter(getClass())
diff --git a/src/test/java21/com/android/tools/r8/jdk21/jdk8272564/Jdk8272564Test.java b/src/test/java21/com/android/tools/r8/jdk21/jdk8272564/Jdk8272564Test.java
index 8b2382e..55b4111 100644
--- a/src/test/java21/com/android/tools/r8/jdk21/jdk8272564/Jdk8272564Test.java
+++ b/src/test/java21/com/android/tools/r8/jdk21/jdk8272564/Jdk8272564Test.java
@@ -6,7 +6,6 @@
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeTrue;
import com.android.tools.r8.TestBase;
import com.android.tools.r8.TestParameters;
@@ -34,6 +33,7 @@
.withCfRuntimesStartingFromIncluding(CfVm.JDK20)
.withDexRuntimes()
.withAllApiLevelsAlsoForCf()
+ .withPartialCompilation()
.build();
}
@@ -118,14 +118,10 @@
assertJdk8272564NotFixedCode(inspector, 19, 0);
}
- private boolean isDefaultCfParameters() {
- return parameters.isCfRuntime() && parameters.getApiLevel().equals(AndroidApiLevel.B);
- }
-
@Test
// See https://bugs.openjdk.java.net/browse/JDK-8272564.
public void testJdk8272564Compiler() throws Exception {
- assumeTrue(isDefaultCfParameters());
+ parameters.assumeJvmTestParameters();
AndroidApp build =
AndroidApp.builder()
.addProgramFiles(ToolHelper.getClassFileForTestClass(Main.class))
@@ -140,7 +136,7 @@
@Test
public void testJvm() throws Exception {
- assumeTrue(isDefaultCfParameters());
+ parameters.assumeJvmTestParameters();
testForJvm(parameters)
.addProgramClasses(getInput())
.run(parameters.getRuntime(), Main.class)
@@ -148,7 +144,7 @@
}
@Test
- public void testD8() throws Exception {
+ public void testDesugaring() throws Exception {
testForDesugaring(parameters)
.addProgramClasses(getInput())
.run(parameters.getRuntime(), Main.class)
@@ -162,6 +158,7 @@
@Test
public void testR8() throws Exception {
parameters.assumeR8TestParameters();
+ parameters.assumeNoPartialCompilation("TODO");
// The R8 lens code rewriter rewrites to the code prior to fixing JDK-8272564.
testForR8(parameters.getBackend())
.addProgramClasses(getInput())
diff --git a/src/test/testbase/java/com/android/tools/r8/IntermediateCfD8TestBuilder.java b/src/test/testbase/java/com/android/tools/r8/IntermediateCfD8TestBuilder.java
index 6d89c19..6dda1a2 100644
--- a/src/test/testbase/java/com/android/tools/r8/IntermediateCfD8TestBuilder.java
+++ b/src/test/testbase/java/com/android/tools/r8/IntermediateCfD8TestBuilder.java
@@ -37,6 +37,16 @@
}
@Override
+ public boolean isD8IntermediateTestBuilder() {
+ return true;
+ }
+
+ @Override
+ public IntermediateCfD8TestBuilder asD8IntermediateTestBuilder() {
+ return this;
+ }
+
+ @Override
IntermediateCfD8TestBuilder self() {
return this;
}
diff --git a/src/test/testbase/java/com/android/tools/r8/TestBase.java b/src/test/testbase/java/com/android/tools/r8/TestBase.java
index 05a2f29..126a615 100644
--- a/src/test/testbase/java/com/android/tools/r8/TestBase.java
+++ b/src/test/testbase/java/com/android/tools/r8/TestBase.java
@@ -346,11 +346,11 @@
return testForRuntime(parameters.getRuntime(), parameters.getApiLevel());
}
- public TestBuilder<DesugarTestRunResult, ?> testForDesugaring(TestParameters parameters) {
+ public DesugarTestBuilder testForDesugaring(TestParameters parameters) {
return testForDesugaring(parameters, null);
}
- public TestBuilder<DesugarTestRunResult, ?> testForDesugaring(
+ public DesugarTestBuilder testForDesugaring(
TestParameters parameters, Consumer<InternalOptions> optionsModification) {
return internalTestForDesugaring(parameters, optionsModification, Predicates.alwaysTrue());
}
@@ -358,14 +358,14 @@
@Deprecated
// This is not supposed to be used for tests. It is here for debugging where filtering to run
// only some (typically one) test configuration is helpful.
- public TestBuilder<DesugarTestRunResult, ?> testForDesugaring(
+ public DesugarTestBuilder testForDesugaring(
TestParameters parameters,
Consumer<InternalOptions> optionsModification,
Predicate<DesugarTestConfiguration> filter) {
return internalTestForDesugaring(parameters, optionsModification, filter);
}
- private TestBuilder<DesugarTestRunResult, ?> internalTestForDesugaring(
+ private DesugarTestBuilder internalTestForDesugaring(
TestParameters parameters,
Consumer<InternalOptions> optionsModification,
Predicate<DesugarTestConfiguration> filter) {
@@ -1761,7 +1761,7 @@
public Path buildOnDexRuntime(TestParameters parameters, byte[]... classes)
throws IOException, CompilationFailedException {
if (parameters.isDexRuntime()) {
- return testForD8()
+ return testForD8(Backend.DEX, PartialCompilationTestParameters.NONE)
.addProgramClassFileData(classes)
.setMinApi(parameters)
.compile()
diff --git a/src/test/testbase/java/com/android/tools/r8/TestBuilder.java b/src/test/testbase/java/com/android/tools/r8/TestBuilder.java
index 190e601..3985d31 100644
--- a/src/test/testbase/java/com/android/tools/r8/TestBuilder.java
+++ b/src/test/testbase/java/com/android/tools/r8/TestBuilder.java
@@ -104,10 +104,42 @@
return self;
}
+ public boolean isD8TestBuilder() {
+ return false;
+ }
+
+ public D8TestBuilder asD8TestBuilder() {
+ return null;
+ }
+
+ public boolean isD8IntermediateTestBuilder() {
+ return false;
+ }
+
+ public IntermediateCfD8TestBuilder asD8IntermediateTestBuilder() {
+ return null;
+ }
+
public boolean isJvmTestBuilder() {
return false;
}
+ public boolean isR8TestBuilder() {
+ return false;
+ }
+
+ public R8TestBuilder<?, ?, ?> asR8TestBuilder() {
+ return null;
+ }
+
+ public boolean isR8PartialTestBuilder() {
+ return false;
+ }
+
+ public R8PartialTestBuilder asR8PartialTestBuilder() {
+ return null;
+ }
+
@Deprecated
public RR run(String mainClass)
throws CompilationFailedException, ExecutionException, IOException {
diff --git a/src/test/testbase/java/com/android/tools/r8/TestBuilderCollection.java b/src/test/testbase/java/com/android/tools/r8/TestBuilderCollection.java
index 287bcb7..3e37931 100644
--- a/src/test/testbase/java/com/android/tools/r8/TestBuilderCollection.java
+++ b/src/test/testbase/java/com/android/tools/r8/TestBuilderCollection.java
@@ -25,7 +25,12 @@
this.builders = builders;
}
- private T forEach(Consumer<TestBuilder<? extends TestRunResult<?>, ?>> fn) {
+ public T allowDiagnosticWarningMessages() {
+ forEach(b -> b.applyIfR8(R8TestBuilder::allowDiagnosticWarningMessages));
+ return self();
+ }
+
+ public T forEach(Consumer<TestBuilder<? extends TestRunResult<?>, ?>> fn) {
builders.forEach(b -> fn.accept(b.getSecond()));
return self();
}
diff --git a/src/test/testbase/java/com/android/tools/r8/TestCompilerBuilder.java b/src/test/testbase/java/com/android/tools/r8/TestCompilerBuilder.java
index 27e2b81..ea6173b 100644
--- a/src/test/testbase/java/com/android/tools/r8/TestCompilerBuilder.java
+++ b/src/test/testbase/java/com/android/tools/r8/TestCompilerBuilder.java
@@ -124,30 +124,6 @@
LibraryDesugaringTestConfiguration libraryDesugaringTestConfiguration =
LibraryDesugaringTestConfiguration.DISABLED;
- public boolean isD8TestBuilder() {
- return false;
- }
-
- public D8TestBuilder asD8TestBuilder() {
- return null;
- }
-
- public boolean isR8TestBuilder() {
- return false;
- }
-
- public R8TestBuilder<?, ?, ?> asR8TestBuilder() {
- return null;
- }
-
- public boolean isR8PartialTestBuilder() {
- return false;
- }
-
- public R8PartialTestBuilder asR8PartialTestBuilder() {
- return null;
- }
-
public boolean isTestShrinkerBuilder() {
return false;
}