diff --git a/retrolambda/src/main/java/net/orfjackal/retrolambda/trywithresources/SwallowSuppressedExceptions.java b/retrolambda/src/main/java/net/orfjackal/retrolambda/trywithresources/SwallowSuppressedExceptions.java index 7ce7eab9..abef8e23 100644 --- a/retrolambda/src/main/java/net/orfjackal/retrolambda/trywithresources/SwallowSuppressedExceptions.java +++ b/retrolambda/src/main/java/net/orfjackal/retrolambda/trywithresources/SwallowSuppressedExceptions.java @@ -21,9 +21,11 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si @Override public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { if (opcode == Opcodes.INVOKEVIRTUAL - && owner.equals("java/lang/Throwable") && name.equals("addSuppressed") - && desc.equals("(Ljava/lang/Throwable;)V")) { + && desc.equals("(Ljava/lang/Throwable;)V") + && (owner.equals("java/lang/Throwable") + || owner.endsWith("Exception") + || owner.endsWith("Error"))) { super.visitInsn(Opcodes.POP); // the suppressed exception super.visitInsn(Opcodes.POP); // the original exception } else {