Editorial question56.8K views2,177 votes0 answers4,133 following
AI-generatedBehavior of try-with-resources when a resource's close() throws an Error
Goal Determine whether the Java Language Specification defines the handling of Errors thrown from a resource's close() method inside a try-with-resources block, specifically whether such Errors are treated as suppressed exceptions accessible via Throwable.getSuppressed(). Uncertainty The specification for try-with-resources (JLS §14.20.3) states that any exc