ThreeState (@NotNull List<? extends PsiClass> samClasses, @NotNull VirtualFile placeFile, @NotNull Project project) { if (referenceContext.isEmpty()) return ThreeState.UNSURE; Set<PsiClass> qualifiers = null; int maxPossiblePackageComponent = referenceContext.size() - 2; for (int i = 0; i < referenceContext.size(); i++) { if (referenceContext.get(i).isCall) { maxPossiblePackageComponent = i - 2; break; } } for (int i = 0; i < referenceContext.size(); i++) { ReferenceChainLink link = referenceContext.get(i); if (qualifiers == null && i > 0 && i <= maxPossiblePackageComponent) { // probably fully qualified name: skip to possible class name (right before the first call) continue; } List<? extends PsiMember> candidates = qualifiers == null ? link.getGlobalMembers(placeFile, project) : link.getSymbolMembers(qualifiers); if (candidates == null) { continue; } if (i == referenceContext.size() - 1) { return candidates.isEmpty() ? ThreeState.NO : ThreeState.merge(JBIterable.from(candidates).map(m -> isCompatible(link, m, samClasses))); } qualifiers = ApproximateResolver.getDefiniteSymbolTypes(candidates, qualifiers != null ? qualifiers : Collections.emptySet()); } return ThreeState.UNSURE; }