< prev index next >
test/tools/javac/TryWithResources/TwrForVariable1.java
Print this page
@@ -35,10 +35,22 @@
assertCloseCount(5);
}
}
assertCloseCount(6);
+
+ // null test cases
+ TwrForVariable1 n = null;
+
+ try (n) {
+ }
+ try (n) {
+ throw new Exception();
+ } catch (Exception e) {
+ }
+
+ assertCloseCount(6);
}
static void assertCloseCount(int expectedCloseCount) {
if (closeCount != expectedCloseCount)
throw new RuntimeException("bad closeCount: " + closeCount +
< prev index next >