Files
openide/java/java-tests/testData/inspection/defUse/TryWithFinally.java
T

15 lines
449 B
Java

class TryWithFinally {
static class Resource implements AutoCloseable {
public void close() throws Exception { }
boolean find() { throw new UnsupportedOperationException(); }
}
void test() throws Exception {
boolean found = <warning descr="Variable 'found' initializer 'false' is redundant">false</warning>;
try (Resource r = new Resource()) {
found = r.find();
}
finally { }
System.out.println(found);
}
}