I also encountered this bug which happens if there there is a loop in the nested/suppressed exceptions. I printed the Throwable hierarchy together with the `System.identityHashCode` of each Throwable of the Exception that triggers the bug. As you can see the Exceptions repeat:
class com.android.tools.r8.CompilationFailedException 1879362884
cause: class com.android.tools.r8.a 1262168655
suppressed[0]: class java.lang.RuntimeException 781103026
cause: class java.util.concurrent.ExecutionException 2050964420
cause: class com.android.tools.r8.utils.Z 147663797
cause: class com.android.tools.r8.a 1262168655
suppressed[0]: class java.lang.RuntimeException 781103026
cause: class java.util.concurrent.ExecutionException 2050964420
cause: class com.android.tools.r8.utils.Z 147663797
cause: class com.android.tools.r8.a 1262168655
suppressed[0]: class java.lang.RuntimeException 781103026
cause: class java.util.concurrent.ExecutionException 2050964420
cause: class com.android.tools.r8.utils.Z 147663797
cause: class com.android.tools.r8.a 1262168655
suppressed[0]: class java.lang.RuntimeException 781103026
cause: class java.util.concurrent.ExecutionException 2050964420
cause: class com.android.tools.r8.utils.Z 147663797
cause: class com.android.tools.r8.a 1262168655
...
Therefore the problem source is simple: there is no loop-detection in the ThrowableProxy implementation, e.g. a `HashSet<Throwable>` where each processed Throwable is recorded so that we can stop when a loop is detected. |