@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 {
   
   
    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));
   
    assertEquals(
        ImmutableSet.of(mainClassSubject.getFinalName(), aClassSubject.getFinalName()),
        compileResult.getMainDexClasses());
  }
@test public void test() throws exception { 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)); assertequals( immutableset.of(mainclasssubject.getfinalname(), aclasssubject.getfinalname()), compileresult.getmaindexclasses()); }