Move NestConstructorRemovedArgTest to jdk11 package
Bug: b/343641859
Change-Id: Icde053e9ec673d19331d8c6e523d999d8e2a046d
diff --git a/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestConstructorRemovedArgTest.java b/src/test/examplesJava11/nesthostexample/NestConstructorRemovedArgTest.java
similarity index 65%
rename from src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestConstructorRemovedArgTest.java
rename to src/test/examplesJava11/nesthostexample/NestConstructorRemovedArgTest.java
index 5b59d1d..70c0120 100644
--- a/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestConstructorRemovedArgTest.java
+++ b/src/test/examplesJava11/nesthostexample/NestConstructorRemovedArgTest.java
@@ -2,18 +2,15 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-package com.android.tools.r8.desugar.nestaccesscontrol;
+package nesthostexample;
-import static com.android.tools.r8.desugar.nestaccesscontrol.NestAccessControlTestUtils.classesOfNest;
-import static com.android.tools.r8.desugar.nestaccesscontrol.NestAccessControlTestUtils.getExpectedResult;
-import static com.android.tools.r8.desugar.nestaccesscontrol.NestAccessControlTestUtils.getMainClass;
+import static nesthostexample.BasicNestHostWithInnerClassConstructors.getExpectedResult;
import com.android.tools.r8.Jdk9TestUtils;
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;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
@@ -22,6 +19,8 @@
@RunWith(Parameterized.class)
public class NestConstructorRemovedArgTest extends TestBase {
+ private static final Class<?> MAIN_CLASS = BasicNestHostWithInnerClassConstructors.class;
+
public NestConstructorRemovedArgTest(TestParameters parameters) {
this.parameters = parameters;
}
@@ -32,8 +31,7 @@
public static TestParametersCollection data() {
return getTestParameters()
.withCfRuntimesStartingFromIncluding(CfVm.JDK11)
- .withDexRuntime(DexVm.Version.first())
- .withDexRuntime(DexVm.Version.last())
+ .withDexRuntimes()
.withApiLevelsStartingAtIncluding(apiLevelWithInvokeCustomSupport())
.enableApiLevelsForCf()
.build();
@@ -42,33 +40,31 @@
@Test
public void testRemoveArgConstructorNestsR8() throws Exception {
parameters.assumeR8TestParameters();
- String nestID = "constructors";
testForR8(parameters.getBackend())
- .addKeepMainRule(getMainClass(nestID))
+ .addKeepMainRule(MAIN_CLASS)
.addDontObfuscate()
.setMinApi(parameters)
.addOptionsModification(options -> options.enableClassInlining = false)
- .addProgramFiles(classesOfNest(nestID))
+ .addProgramClassesAndInnerClasses(MAIN_CLASS)
.applyIf(parameters.isCfRuntime(), Jdk9TestUtils.addJdk9LibraryFiles(temp))
.compile()
- .run(parameters.getRuntime(), getMainClass(nestID))
- .assertSuccessWithOutput(getExpectedResult(nestID));
+ .run(parameters.getRuntime(), MAIN_CLASS)
+ .assertSuccessWithOutputLines(getExpectedResult());
}
@Test
public void testRemoveArgConstructorNestsR8NoTreeShaking() throws Exception {
parameters.assumeR8TestParameters();
- String nestID = "constructors";
testForR8(parameters.getBackend())
.noTreeShaking()
- .addKeepMainRule(getMainClass(nestID))
+ .addKeepMainRule(MAIN_CLASS)
.addDontObfuscate()
.setMinApi(parameters)
.addOptionsModification(options -> options.enableClassInlining = false)
- .addProgramFiles(classesOfNest(nestID))
+ .addProgramClassesAndInnerClasses(MAIN_CLASS)
.applyIf(parameters.isCfRuntime(), Jdk9TestUtils.addJdk9LibraryFiles(temp))
.compile()
- .run(parameters.getRuntime(), getMainClass(nestID))
- .assertSuccessWithOutput(getExpectedResult(nestID));
+ .run(parameters.getRuntime(), MAIN_CLASS)
+ .assertSuccessWithOutputLines(getExpectedResult());
}
}
diff --git a/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestAccessControlTestUtils.java b/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestAccessControlTestUtils.java
index 8f73003..e0df74d 100644
--- a/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestAccessControlTestUtils.java
+++ b/src/test/java/com/android/tools/r8/desugar/nestaccesscontrol/NestAccessControlTestUtils.java
@@ -68,13 +68,6 @@
"NestHostExample$StaticNestMemberInner$StaticNestMemberInnerInner",
"NestHostExample$StaticNestInterfaceInner",
"NestHostExample$ExampleEnumCompilation");
- public static final int NUMBER_OF_TEST_CLASSES = CLASS_NAMES.size();
-
- // The following map use ids, i.e., strings which represents respectively
- // a nest with only field, method, constructor, anonymous class and
- // all at once nest based private accesses.
- public static final ImmutableList<String> NEST_IDS =
- ImmutableList.of("fields", "methods", "constructors", "anonymous", "all");
public static final ImmutableMap<String, String> MAIN_CLASSES =
ImmutableMap.<String, String>builder()
.put("fields", "BasicNestHostWithInnerClassFields")
@@ -169,10 +162,6 @@
return EXPECTED_RESULTS.get(id);
}
- public static List<Path> classesOfNest(String nestID) {
- return classesMatching(MAIN_CLASSES.get(nestID));
- }
-
public static List<Path> classesMatching(String matcher) {
return CLASS_NAMES.stream()
.filter(name -> containsString(matcher).matches(name))