private static boolean findWeakestType(PsiThrowStatement throwStatement, PsiClass variableOrMethodClass,
                                         Set<PsiClass> weakestTypeClasses) {
    final PsiClassType runtimeExceptionType = TypeUtils.getType(CommonClassNames.JAVA_LANG_RUNTIME_EXCEPTION, throwStatement);
    final PsiClass runtimeExceptionClass = runtimeExceptionType.resolve();
    if (runtimeExceptionClass != null && InheritanceUtil.isInheritorOrSelf(variableOrMethodClass, runtimeExceptionClass, true)) {
      return checkType(runtimeExceptionType, weakestTypeClasses);
    }
    final PsiMethod method = PsiTreeUtil.getParentOfType(throwStatement, PsiMethod.class);
    if (method == null) {
      return false;
    }
    final PsiReferenceList throwsList = method.getThrowsList();
    final PsiClassType[] referencedTypes = throwsList.getReferencedTypes();
    boolean checked = false;
    for (PsiClassType referencedType : referencedTypes) {
      ProgressManager.checkCanceled();
      final PsiClass throwableClass = referencedType.resolve();
      if (throwableClass == null ||
          !InheritanceUtil.isInheritorOrSelf(variableOrMethodClass, throwableClass, true)) {
        continue;
      }
      if (!checkType(referencedType, weakestTypeClasses)) {
        continue;
      }
      checked = true;
      break;
    }
    return checked;
  }
private static boolean findWeakestType(PsiThrowStatement throwStatement, PsiClass variableOrMethodClass,
                                         Set<PsiClass> weakestTypeClasses)