public boolean checkInheritance(@NotNull PsiClass inheritorCandidate) {
    if (!inheritorCandidate.isValid() || !myBaseClass.isValid()) return false;
    PsiFile inheritorCandidateContainingFile = inheritorCandidate.getContainingFile();
    if (myFileIndex.isInSourceContent(inheritorCandidateContainingFile.getVirtualFile())) {
      ClassesAndAmbiguities value = myClasses.getValue();
      boolean hasGlobalAmbiguities = value.isAmbiguous;
      if (!hasGlobalAmbiguities) {
        return true;
      }

      PsiClass[] classes = value.classes;
      PsiFile[] files = value.containingFiles;
      GlobalSearchScope scope = ResolveScopeManager.getInstance(inheritorCandidateContainingFile.getProject()).getResolveScope(inheritorCandidateContainingFile);
      String ambiguity = null;
      boolean hasBaseClass = false;
      for (int i = 0; i < classes.length; i++) {
        PsiClass base = classes[i];
        PsiFile file = files[i];
        if (PsiSearchScopeUtil.isInScope(scope, file) && isAccessibleLight(inheritorCandidate, inheritorCandidateContainingFile, base)) {
          hasBaseClass |= base.equals(myBaseClass);
          ambiguity = hasAmbiguitiesSoFar(base, ambiguity);
        }
      }
      if (!Strings.areSameInstance(ambiguity, AMBIGUITY_FOUND)) {
        return hasBaseClass;
      }
    }

    if (inheritorCandidate instanceof PsiCompiledElement && isEnumOrAnnotationInheritor(inheritorCandidate)) {
      return true;
    }

    return inheritorCandidate.isInheritor(myBaseClass, false);
  }
public boolean checkInheritance(@NotNull PsiClass inheritorCandidate)