boolean (Object element, PsiElement context) { PsiElement cachedVar = context; if(myCurrentContext.get() != context){ myCurrentContext = new SoftReference<>(context); while(cachedVar != null && !(getFilter().isAcceptable(cachedVar, cachedVar.getContext()))) cachedVar = cachedVar.getContext(); myCachedVar = new SoftReference<>(cachedVar); } if (element instanceof PsiMethod currentMethod && myCachedVar.get() instanceof PsiMethod candidate) { return !candidate.getManager().areElementsEquivalent(candidate, currentMethod) && !isOverridingMethod(currentMethod, candidate); } else if(element instanceof PsiClassType){ final PsiClass psiClass = ((PsiClassType)element).resolve(); return isAcceptable(psiClass, context); } else if(context != null){ if(element instanceof PsiElement) return !context.getManager().areElementsEquivalent(myCachedVar.get(), (PsiElement)element); return true; } return true; }