mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Resolve in resource list tuned to not look forward
This commit is contained in:
@@ -198,9 +198,14 @@ public class PsiImplUtil {
|
||||
@NotNull final PsiScopeProcessor processor,
|
||||
@NotNull final ResolveState state,
|
||||
final PsiElement lastParent) {
|
||||
final ElementClassHint hint = processor.getHint(ElementClassHint.KEY);
|
||||
if (hint != null && !hint.shouldProcess(ElementClassHint.DeclaractionKind.VARIABLE)) return true;
|
||||
|
||||
final List<PsiResourceVariable> resources = resourceList.getResourceVariables();
|
||||
for (PsiResourceVariable resource : resources) {
|
||||
if (!resource.equals(lastParent) && !processor.execute(resource, state)) return false;
|
||||
@SuppressWarnings({"SuspiciousMethodCalls"})
|
||||
final int lastIdx = lastParent instanceof PsiResourceVariable ? resources.indexOf(lastParent) : resources.size();
|
||||
for (int i = 0; i < lastIdx; i++) {
|
||||
if (!processor.execute(resources.get(i), state)) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
+7
-2
@@ -46,11 +46,11 @@ class C {
|
||||
}
|
||||
<error descr="Cannot resolve symbol 'r'">r</error> = null;
|
||||
|
||||
try (MyResource <error descr="Variable 'r' is already defined in the scope">r</error> = new MyResource(); MyResource <error descr="Variable 'r' is already defined in the scope">r</error> = new MyResource()) { }
|
||||
try (MyResource r = new MyResource(); MyResource <error descr="Variable 'r' is already defined in the scope">r</error> = new MyResource()) { }
|
||||
|
||||
try (MyResource r1 = new MyResource(); MyResource r2 = r1) { }
|
||||
|
||||
/* todo: try (MyResource r1 = < error descr="Cannot resolve symbol 'r'">r2</error >; MyResource r2 = r1) { }*/
|
||||
try (MyResource r1 = <error descr="Cannot resolve symbol 'r2'">r2</error>; MyResource r2 = r1) { }
|
||||
|
||||
MyResource r = null;
|
||||
try (MyResource <error descr="Variable 'r' is already defined in the scope">r</error> = new MyResource()) { }
|
||||
@@ -64,4 +64,9 @@ class C {
|
||||
}
|
||||
}.run();
|
||||
}
|
||||
|
||||
void m4() throws Exception {
|
||||
MyResource r;
|
||||
try (MyResource r1 = <error descr="Variable 'r' might not have been initialized">r</error>) { }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user