IDEA-92335 (DFA in resource variable initializer)

This commit is contained in:
Roman Shevchenko
2012-10-02 19:54:43 +02:00
parent 9c796a4342
commit 8377cdda86
3 changed files with 41 additions and 5 deletions
@@ -1,5 +1,3 @@
import java.lang.Exception;
class C {
static class MyResource implements AutoCloseable {
@Override public void close() { }
@@ -25,4 +23,21 @@ class C {
System.out.println(r);
}
}
interface MyResourceProvider {
MyResource getResource();
}
void m3() throws Exception {
MyResourceProvider provider = null;
try (MyResource r = <warning descr="Method invocation 'provider.getResource()' may produce 'java.lang.NullPointerException'">provider.getResource()</warning>) {
System.out.println(r);
}
}
void m4() {
try (MyResource r = null) {
System.out.println(r);
}
}
}