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

14 lines
436 B
Java

class TryWithoutFinally {
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();
}
System.out.println(found);
}
}