EA-54551 - IAE: ResolveUtil.treeWalkUp

This commit is contained in:
Max Medvedev
2014-03-14 08:41:53 +04:00
parent a5cc688a8a
commit 7e4886668b
@@ -466,7 +466,9 @@ public class GrCodeReferenceElementImpl extends GrReferenceElementImpl<GrCodeRef
}
@NotNull
private static GroovyResolveResult[] _resolve(GrCodeReferenceElementImpl ref, PsiManager manager, ReferenceKind kind) {
private static GroovyResolveResult[] _resolve(@NotNull GrCodeReferenceElementImpl ref,
@NotNull PsiManager manager,
@NotNull ReferenceKind kind) {
final String refName = ref.getReferenceName();
if (refName == null) {
return GroovyResolveResult.EMPTY_ARRAY;
@@ -515,9 +517,11 @@ public class GrCodeReferenceElementImpl extends GrReferenceElementImpl<GrCodeRef
// if ref is an annotation name reference we should not process declarations of annotated elements
// because inner annotations are not permitted and it can cause infinite recursion
PsiElement placeToStartWalking = isAnnotationRef(ref) ? FileContextUtil.getContextFile(ref) : ref;
ResolveUtil.treeWalkUp(placeToStartWalking, processor, false);
GroovyResolveResult[] candidates = processor.getCandidates();
if (candidates.length > 0) return candidates;
if (placeToStartWalking != null) {
ResolveUtil.treeWalkUp(placeToStartWalking, processor, false);
GroovyResolveResult[] candidates = processor.getCandidates();
if (candidates.length > 0) return candidates;
}
if (kind == CLASS_OR_PACKAGE) {
PsiPackage pkg = JavaPsiFacade.getInstance(ref.getProject()).findPackage(refName);