Closed
Description
Though the try-with-resources statement doesn't introduce any new bytecode instructions, it uses the Throwable.addSuppressed method which was added in Java 7. Possible options for a backport:
- Swallow the suppressed exception
- Throw the suppressed exception, swallowing the original exception
- Print the stack trace of suppressed exceptions
- Log the suppressed exceptions
Option 2 is clearly undesirable. I think option 3 would possibly cause lots of unwanted stack traces in the console. Option 4 is what Guava's Closer does.
I think the viable options are 1 and 4.
Metadata
Metadata
Assignees
Labels
No labels