Fix DefaultInterfaceMethodProfileRewritingTest failure
Change-Id: I33df8d43a5bc08073af654573a72e9498e83434c
diff --git a/src/test/java/com/android/tools/r8/profile/art/completeness/DefaultInterfaceMethodProfileRewritingTest.java b/src/test/java/com/android/tools/r8/profile/art/completeness/DefaultInterfaceMethodProfileRewritingTest.java
index 64191b4..194269e 100644
--- a/src/test/java/com/android/tools/r8/profile/art/completeness/DefaultInterfaceMethodProfileRewritingTest.java
+++ b/src/test/java/com/android/tools/r8/profile/art/completeness/DefaultInterfaceMethodProfileRewritingTest.java
@@ -43,7 +43,7 @@
.addArtProfileForRewriting(getArtProfile())
.setMinApi(parameters.getApiLevel())
.compile()
- .inspectResidualArtProfile(this::inspect)
+ .inspectResidualArtProfile(this::inspectD8)
.run(parameters.getRuntime(), Main.class)
.assertSuccessWithOutputLines("Hello, world!");
}
@@ -59,7 +59,7 @@
.enableNoHorizontalClassMergingAnnotations()
.setMinApi(parameters.getApiLevel())
.compile()
- .inspectResidualArtProfile(this::inspect)
+ .inspectResidualArtProfile(this::inspectR8)
.run(parameters.getRuntime(), Main.class)
.assertSuccessWithOutputLines("Hello, world!");
}
@@ -70,8 +70,25 @@
.build();
}
- private void inspect(ArtProfileInspector profileInspector, CodeInspector inspector) {
- if (parameters.canUseDefaultAndStaticInterfaceMethodsWhenDesugaring()) {
+ private void inspectD8(ArtProfileInspector profileInspector, CodeInspector inspector) {
+ inspect(
+ profileInspector,
+ inspector,
+ parameters.canUseDefaultAndStaticInterfaceMethodsWhenDesugaring());
+ }
+
+ private void inspectR8(ArtProfileInspector profileInspector, CodeInspector inspector) {
+ inspect(
+ profileInspector,
+ inspector,
+ parameters.isCfRuntime() || parameters.canUseDefaultAndStaticInterfaceMethods());
+ }
+
+ private void inspect(
+ ArtProfileInspector profileInspector,
+ CodeInspector inspector,
+ boolean canUseDefaultAndStaticInterfaceMethods) {
+ if (canUseDefaultAndStaticInterfaceMethods) {
ClassSubject iClassSubject = inspector.clazz(I.class);
assertThat(iClassSubject, isPresent());