test/tools/javac/TryWithResources/TwrSuppression.java

changeset 745
4328728e0409
parent 622
38e2c23309f1
child 2525
2eb010b6cb22
equal deleted inserted replaced
744:a7faadc252c8 745:4328728e0409
34 try (TwrSuppression r1 = new TwrSuppression(false); 34 try (TwrSuppression r1 = new TwrSuppression(false);
35 TwrSuppression r2 = new TwrSuppression(true)) { 35 TwrSuppression r2 = new TwrSuppression(true)) {
36 throw new RuntimeException(); 36 throw new RuntimeException();
37 } 37 }
38 } catch(RuntimeException e) { 38 } catch(RuntimeException e) {
39 Throwable[] suppressedExceptions = e.getSuppressedExceptions(); 39 Throwable[] suppressedExceptions = e.getSuppressed();
40 int length = suppressedExceptions.length; 40 int length = suppressedExceptions.length;
41 if (length != 2) 41 if (length != 2)
42 throw new RuntimeException("Unexpected length " + length); 42 throw new RuntimeException("Unexpected length " + length);
43 43
44 if (suppressedExceptions[0].getClass() != Error.class || 44 if (suppressedExceptions[0].getClass() != Error.class ||

mercurial