boolean (@NotNull PsiElement element, @NotNull ResolveState state) { if (element instanceof PsiLocalVariableImpl) { //todo a better hack return true; // the debugger creates a Java code block context and our expressions to evaluate resolve there } if (myResolveTargetKinds == null || myResolveTargetKinds.contains(getDeclarationKind(element))) { //hack for resolve of java local vars and parameters //don't check field for name because they can be aliased imported if (element instanceof PsiVariable && !(element instanceof PsiField) && myName != null && !myName.equals(((PsiVariable)element).getName())) { return true; } PsiNamedElement namedElement = (PsiNamedElement)element; PsiSubstitutor substitutor = state.get(PsiSubstitutor.KEY); if (substitutor == null) substitutor = PsiSubstitutor.EMPTY; if (myTypeArguments.length > 0 && namedElement instanceof PsiClass) { substitutor = substitutor.putAll((PsiClass)namedElement, myTypeArguments); } if (namedElement instanceof PsiClass aClass && !(namedElement instanceof PsiTypeParameter)) { if (myProcessedClasses == null) myProcessedClasses = new HashSet<>(); if (!myProcessedClasses.add(aClass.getQualifiedName())) { return true; } } boolean isAccessible = isAccessible(namedElement); final PsiElement resolveContext = state.get(RESOLVE_CONTEXT); final SpreadState spreadState = state.get(SpreadState.SPREAD_STATE); boolean isStaticsOK = isStaticsOK(namedElement, resolveContext, false); addCandidate(new GroovyResolveResultImpl(namedElement, resolveContext, spreadState, substitutor, isAccessible, isStaticsOK)); return !(isAccessible && isStaticsOK); } return true; }