Report a warning instead of fatal throw when implementing a class
Bug: b/254386325
Change-Id: I31ab1e62dcc19d201d760113ede1aad738b98a92
diff --git a/src/main/java/com/android/tools/r8/shaking/Enqueuer.java b/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
index 30a8723..213819d 100644
--- a/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
+++ b/src/main/java/com/android/tools/r8/shaking/Enqueuer.java
@@ -2226,19 +2226,6 @@
return;
}
- if (!clazz.isInterface()) {
- throw appView
- .reporter()
- .fatalError(
- "The class "
- + implementer
- + " implements the interface "
- + type
- + " but "
- + type
- + " is not an interface.");
- }
-
if (!appView.options().enableUnusedInterfaceRemoval
|| rootSet.noUnusedInterfaceRemoval.contains(type)
|| mode.isMainDexTracing()) {
@@ -2252,6 +2239,21 @@
return;
}
+ if (mode.isInitialTreeShaking()) {
+ if (!clazz.isInterface()) {
+ appView
+ .reporter()
+ .warning(
+ "The class "
+ + implementer
+ + " implements the interface "
+ + type
+ + " but "
+ + type
+ + " is not an interface.");
+ }
+ }
+
// No need to mark the type as live. If an interface type is only reachable via the
// inheritance clause of another type it can simply be removed from the inheritance clause.
// The interface is needed if it has a live default interface method or field, though.