CaptureTraverser (@Nullable PsiClass targetClass, @Nullable PsiClass fromClass, boolean checkInheritance) { if (targetClass == null || fromClass == null) return INVALID; int iterationCount = 0; while (fromClass != null && !fromClass.equals(targetClass) && (!checkInheritance || !fromClass.isInheritor(targetClass, true))) { iterationCount++; fromClass = getOuterClass(fromClass); } return fromClass == null ? INVALID : new CaptureTraverser(iterationCount); }