Fixup tests after changes to vertical class merger
Change-Id: I9966903609fc09b96fa46d0712cc0c81f24c6432
diff --git a/src/test/java/com/android/tools/r8/classmerging/vertical/VerticalClassMergingWithMissingTypeArgsSubstitutionTest.java b/src/test/java/com/android/tools/r8/classmerging/vertical/VerticalClassMergingWithMissingTypeArgsSubstitutionTest.java
index 4fad79d..fdef90e 100644
--- a/src/test/java/com/android/tools/r8/classmerging/vertical/VerticalClassMergingWithMissingTypeArgsSubstitutionTest.java
+++ b/src/test/java/com/android/tools/r8/classmerging/vertical/VerticalClassMergingWithMissingTypeArgsSubstitutionTest.java
@@ -46,6 +46,7 @@
.enableInliningAnnotations()
.enableNoMethodStaticizingAnnotations()
.enableConstantArgumentAnnotations()
+ .noMinification()
.setMinApi(parameters.getApiLevel())
.run(parameters.getRuntime(), Main.class)
.assertSuccessWithOutputLines("T", "Hello World")
@@ -59,17 +60,21 @@
MethodSubject bar = classSubject.uniqueMethodWithName("bar");
assertThat(bar, isPresentAndRenamed());
assertEquals("(TT;)V", bar.getFinalSignatureAttribute());
- // The NeverInline is transferred to the private vertically merged method, making
- // it hard to lookup.
- MethodSubject movedFooSubject =
+ // The NeverInline is transferred to the private vertically merged method but also
+ // copied to the virtual bridge.
+ MethodSubject fooMovedFromB =
classSubject.uniqueMethodThatMatches(
- method ->
- method.getMethod().getReference() != bar.getMethod().getReference()
- && !method.isInstanceInitializer());
- assertThat(movedFooSubject, isPresentAndRenamed());
+ method -> !method.isVirtual() && method.getOriginalName(false).equals("foo"));
+ assertThat(fooMovedFromB, isPresentAndRenamed());
assertEquals(
"(Ljava/lang/Object;)Ljava/lang/Object;",
- movedFooSubject.getFinalSignatureAttribute());
+ fooMovedFromB.getFinalSignatureAttribute());
+ MethodSubject fooBridge =
+ classSubject.uniqueMethodThatMatches(
+ method -> method.isVirtual() && method.getOriginalName(false).equals("foo"));
+ assertThat(fooBridge, isPresentAndRenamed());
+ assertEquals(
+ "(Ljava/lang/Object;)Ljava/lang/Object;", fooBridge.getFinalSignatureAttribute());
});
}
diff --git a/src/test/java/com/android/tools/r8/naming/applymapping/ApplyMappingAfterVerticalMergingMethodTest.java b/src/test/java/com/android/tools/r8/naming/applymapping/ApplyMappingAfterVerticalMergingMethodTest.java
index 57b70d2..198fcde 100644
--- a/src/test/java/com/android/tools/r8/naming/applymapping/ApplyMappingAfterVerticalMergingMethodTest.java
+++ b/src/test/java/com/android/tools/r8/naming/applymapping/ApplyMappingAfterVerticalMergingMethodTest.java
@@ -121,13 +121,13 @@
assertThat(inspector.clazz(LibrarySubclass.class), isPresent());
List<FoundMethodSubject> methods =
inspector.clazz(LibrarySubclass.class).allMethods();
- assertEquals(3, methods.size());
+ assertEquals(4, methods.size());
assertEquals(
1, methods.stream().filter(FoundMethodSubject::isInstanceInitializer).count());
assertEquals(
1, methods.stream().filter(m -> m.getFinalName().contains("main")).count());
assertEquals(
- 1, methods.stream().filter(m -> m.getOriginalName().contains("foo")).count());
+ 2, methods.stream().filter(m -> m.getOriginalName().contains("foo")).count());
});
}