The problem is that you probably are not testing all cases for your attempt using the resource block. Every time you write something like:
try(Autocloseable ac = new Autocloseable()) {
} catch(Exception e) {
}
The compiler interprets something like:
Autocloseable ac = null;
Exception e = null;
try {
ac = new Autocloseable();
} catch (Exception e1) {
e = e1
} finally {
if(ac != null) {
try {
ac.close();
} catch (Exception e2) {
throw e == null? e2 : e;
}
if(e != null ) throw e;
}
}
, , , , .
, , .