Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am saberduck on github.
  • I am saberduck (https://keybase.io/saberduck) on keybase.
  • I have a public key ASARBS9kU3Hh0KzSYfWqdwPZKv_IQ6tGe18dh5YQxT9lNgo

To claim this, I am signing this object:

@saberduck
saberduck / TryWithResourcesTest.java
Created January 25, 2018 17:14
try-with-resources and suppressed exceptions
public class TryWithResourcesTest {
public static void main(String[] args) throws Exception {
try (MyClosable a = new MyClosable()) {
if (System.currentTimeMillis() % 2 == 0) {
throw new RuntimeException("Exception on try block");
}
} catch (Exception e) {
Throwable[] suppressed = e.getSuppressed();