Add keep rule to DefaultMethodsTest
Change-Id: If46b2ffab878342de68d4cd5a87e9bd24436e264
diff --git a/src/test/java/com/android/tools/r8/shaking/defaultmethods/DefaultMethodsTest.java b/src/test/java/com/android/tools/r8/shaking/defaultmethods/DefaultMethodsTest.java
index 5845dd3..e543d46 100644
--- a/src/test/java/com/android/tools/r8/shaking/defaultmethods/DefaultMethodsTest.java
+++ b/src/test/java/com/android/tools/r8/shaking/defaultmethods/DefaultMethodsTest.java
@@ -86,18 +86,24 @@
" public int method();",
"}"
), this::defaultMethodKept);
- runTest(ImmutableList.of(
- "-keep class " + ClassImplementingInterface.class.getCanonicalName() + "{",
- " <methods>;",
- "}"
- ), this::defaultMethodNotKept);
- runTest(ImmutableList.of(
- "-keep class " + ClassImplementingInterface.class.getCanonicalName() + "{",
- " <methods>;",
- "}",
- "-keep class " + TestClass.class.getCanonicalName() + "{",
- " public void useInterfaceMethod();",
- "}"
- ), this::defaultMethodAbstract);
+ runTest(
+ ImmutableList.of(
+ "-keep class " + ClassImplementingInterface.class.getCanonicalName() + "{",
+ " <methods>;",
+ "}",
+ // Prevent InterfaceWithDefaultMethods from being merged into ClassImplementingInterface
+ "-keep class " + InterfaceWithDefaultMethods.class.getCanonicalName()),
+ this::defaultMethodNotKept);
+ runTest(
+ ImmutableList.of(
+ "-keep class " + ClassImplementingInterface.class.getCanonicalName() + "{",
+ " <methods>;",
+ "}",
+ "-keep class " + TestClass.class.getCanonicalName() + "{",
+ " public void useInterfaceMethod();",
+ "}",
+ // Prevent InterfaceWithDefaultMethods from being merged into ClassImplementingInterface
+ "-keep class " + InterfaceWithDefaultMethods.class.getCanonicalName()),
+ this::defaultMethodAbstract);
}
}