mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-04 08:51:02 +07:00
Fixes IDEA-304296 False positive warnings and non-equivalent quick fixes in control flow analysis of try-with-resources not taking into account possible exceptions thrown from close() GitOrigin-RevId: df8c30a26d67817fb6412c378fa1fe11fb2e007b
24 lines
476 B
Java
24 lines
476 B
Java
// IDEA-304296
|
|
class Example {
|
|
public static void main(String[] args) {
|
|
boolean done = false;
|
|
try (final ThrowsOnClose resource = new ThrowsOnClose()) {
|
|
resource.foo();
|
|
done = true;
|
|
} catch (RuntimeException e) {
|
|
if (!done) {
|
|
throw e;
|
|
}
|
|
}
|
|
}
|
|
|
|
private static class ThrowsOnClose implements AutoCloseable {
|
|
public void foo() {
|
|
}
|
|
|
|
@Override
|
|
public void close() {
|
|
throw new RuntimeException();
|
|
}
|
|
}
|
|
} |