void () { //for (Iterator iterator = myDependencyMap.keySet().getSectionsIterator(); getSectionsIterator.hasNext();) { for (final PsiElement element : myElementToNode.keySet()) { if (element instanceof PsiExpression) { final PsiElement parent = element.getParent(); if (parent instanceof PsiReferenceExpression refExpr && element.equals(refExpr.getQualifierExpression())) { final PsiElement refElement = refExpr.resolve(); if (refElement != null && !isInSuper(refElement)) { markNode(element); } } } else if (!myReplaceInstanceOf && element.getParent() != null && element.getParent().getParent() instanceof PsiInstanceOfExpression) { markNode(element); } else if (element.getParent() instanceof PsiClassObjectAccessExpression) { markNode(element); } else if (element instanceof PsiParameter) { final PsiType type = TypeConversionUtil.erasure(((PsiParameter)element).getType()); final PsiClass aClass = PsiUtil.resolveClassInType(type); if (aClass != null) { if (!myManager.isInProject(element) || !myManager.areElementsEquivalent(aClass, myClass)) { if (!isSuperInheritor(aClass)) { markNode(element); } } } else { // unresolvable class markNode(element); } } } } protected abstract boolean isSuperInheritor(PsiClass aClass); protected abstract boolean isInSuper(PsiElement member); protected void addLink(PsiElement source, PsiElement target) { Node from = myElementToNode.get(source); Node to = myElementToNode.get(target); if (from == null) { from = new Node(source); if (source instanceof PsiExpression) myExpressionsQueue.addLast((PsiExpression)source); myElementToNode.put(source, from); } if (to == null) { to = new Node(target); if (target instanceof PsiExpression) myExpressionsQueue.addLast((PsiExpression)target); myElementToNode.put(target, to); } Edge.connect(from, to); } private void spreadMarks() { final LinkedList<MarkedNode> markedNodes = new LinkedList<>(); for (final PsiElement markedNode : myMarkedNodes) { final Node node = myElementToNode.get(markedNode); if (node != null) markedNodes.addFirst(node); } GlobalAnalyzer.doOneEnd(markedNodes, new Colorer()); } private void markNode(final PsiElement node) { myMarkedNodes.add(node); } class Colorer implements OneEndFunctor { @Override public Mark compute(Mark from, Mark edge, Mark to) { VisitMark mark = new VisitMark((VisitMark)to); myMarkedNodes.add(mark.getElement()); mark.switchOn(); return mark; } } private static final class Edge extends EdgeImpl { private Edge(Node from, Node to) { super(from, to); } public static boolean connect(Node from, Node to) { if (from.mySuccessors.add(to)) { new Edge(from, to); return true; } return false; } } private static class VisitMark implements Mark { private boolean myVisited; private final PsiElement myElement; @Override public boolean coincidesWith(Mark x) { return ((VisitMark)x).myVisited == myVisited; } VisitMark(VisitMark m) { myVisited = false; myElement = m.myElement; } VisitMark(PsiElement e) { myVisited = false; myElement = e; } public void switchOn() { myVisited = true; } public void switchOff() { myVisited = false; } public PsiElement getElement() { return myElement; } } private static final class Node extends NodeImpl { private final Set<Node> mySuccessors = new HashSet<>(); private VisitMark myMark; Node(PsiElement x) { super(); myMark = new VisitMark(x); } @Override public Mark getMark() { return myMark; } @Override public void setMark(Mark x) { myMark = (VisitMark)x; } } }