mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 03:13:40 +07:00
IDEA-92335 (DFA in resource variable initializer)
This commit is contained in:
+17
-2
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user