ResolveResult[] (PsiPolyVariantReference ref, PolyVariantResolver resolver, boolean needToPreventRecursion, boolean incompleteCode) { ProgressManager.getInstance().checkCanceled(); int clearCountOnStart; synchronized (PsiLock.LOCK) { clearCountOnStart = myClearCount; } boolean physical = ref.getElement().isPhysical(); final ResolveResult[] cached = getCachedPolyVariantResolve(ref, physical, incompleteCode); if (cached != null) return cached; if (incompleteCode) { final ResolveResult[] results = resolveWithCaching(ref, resolver, needToPreventRecursion, false); if (results != null && results.length > 0) { setCachedPolyVariantResolve(ref, results, physical, true, clearCountOnStart); return results; } } if (!lockElement(ref, needToPreventRecursion)) return JavaResolveResult.EMPTY_ARRAY; ResolveResult[] result; try { result = resolver.resolve(ref, incompleteCode); } finally { unlockElement(ref, needToPreventRecursion); } setCachedPolyVariantResolve(ref, result, physical, incompleteCode, clearCountOnStart); return result; }