// The generated main dex list should contain Main (which is a root) and A (which is a direct
// dependency of Main).
@Test
  public void test() throws Exception {
    // The generated main dex list should contain Main (which is a root) and A (which is a direct
    // dependency of Main).
    assertEquals(2, mainDexList.size());
    assertEquals(A.class.getTypeName(), mainDexList.get(0).getTypeName());
    assertEquals(Main.class.getTypeName(), mainDexList.get(1).getTypeName());
    R8TestCompileResult compileResult =
        testForR8(parameters.getBackend())
            .addInnerClasses(getClass())
            .addInliningAnnotations()
            .addKeepClassAndMembersRules(Main.class)
            .addMainDexListClassReferences(mainDexList)
            .collectMainDexClasses()
            .enableInliningAnnotations()
            .enableNoHorizontalClassMergingAnnotations()
            .enableNoHorizontalClassMergingAnnotations()
            .setMinApi(parameters.getApiLevel())
            .allowDiagnosticMessages()
            .compileWithExpectedDiagnostics(
                diagnostics ->
                    diagnostics
                        .assertOnlyWarnings()
                        .assertWarningsMatch(
                            diagnosticType(UnsupportedMainDexListUsageDiagnostic.class)));
    CodeInspector inspector = compileResult.inspector();
    ClassSubject mainClassSubject = inspector.clazz(Main.class);
    assertThat(mainClassSubject, isPresent());
    MethodSubject fooMethodSubject = mainClassSubject.uniqueMethodWithName("foo");
    assertThat(fooMethodSubject, isPresent());
    ClassSubject aClassSubject = inspector.clazz(A.class);
    assertThat(aClassSubject, isPresent());
    MethodSubject barMethodSubject = aClassSubject.uniqueMethodWithName("bar");
    assertThat(barMethodSubject, isPresent());
    ClassSubject bClassSubject = inspector.clazz(B.class);
    assertThat(bClassSubject, isPresent());
    MethodSubject bazMethodSubject = bClassSubject.uniqueMethodWithName("baz");
    assertThat(bazMethodSubject, isPresent());
    assertThat(fooMethodSubject, invokesMethod(barMethodSubject));
    assertThat(barMethodSubject, invokesMethod(bazMethodSubject));
    // The main dex classes should be the same as the input main dex list.
    assertEquals(
        ImmutableSet.of(mainClassSubject.getFinalName(), aClassSubject.getFinalName()),
        compileResult.getMainDexClasses());
  }
@Test
public void test() throws Exception {
// The generated main dex list should contain Main (which is a root) and A (which is a direct
// dependency of Main).
assertEquals(2, mainDexList.size());
assertEquals(A.class.getTypeName(), mainDexList.get(0).getTypeName());
@Test
public void test() throws Exception {
// The generated main dex list should contain Main (which is a root) and A (which is a direct
// dependency of Main).
assertEquals(2, mainDexList.size());
assertEquals(A.class.getTypeName(), mainDexList.get(0).getTypeName());
assertEquals(Main.class.getTypeName(), mainDexList.get(1).getTypeName());
R8TestCompileResult compileResult =
testForR8(parameters.getBackend())
.addInnerClasses(getClass())
.addInliningAnnotations()
.addKeepClassAndMembersRules(Main.class)
.addMainDexListClassReferences(mainDexList)
.collectMainDexClasses()
@Test
public void test() throws Exception {
// The generated main dex list should contain Main (which is a root) and A (which is a direct
// dependency of Main).
assertEquals(2, mainDexList.size());
assertEquals(A.class.getTypeName(), mainDexList.get(0).getTypeName());
assertEquals(Main.class.getTypeName(), mainDexList.get(1).getTypeName());
R8TestCompileResult compileResult =
testForR8(parameters.getBackend())
.addInnerClasses(getClass())
.addInliningAnnotations()
.addKeepClassAndMembersRules(Main.class)
.addMainDexListClassReferences(mainDexList)
.collectMainDexClasses()
.enableInliningAnnotations()
.enableNoHorizontalClassMergingAnnotations()
.enableNoHorizontalClassMergingAnnotations()
.setMinApi(parameters.getApiLevel())
.allowDiagnosticMessages()
.compileWithExpectedDiagnostics(
diagnostics ->
diagnostics
.assertOnlyWarnings()
.assertWarningsMatch(