private static InferenceMode getInferenceMode(@NotNull PsiMethodImpl method) {
    if (isLibraryCode(method) ||
        ((PsiMethod)method).hasModifierProperty(PsiModifier.ABSTRACT) ||
        ((PsiMethod)method).hasModifierProperty(PsiModifier.NATIVE)) {
      return InferenceMode.DISABLED;
    }

    if (((PsiMethod)method).hasModifierProperty(PsiModifier.STATIC)) return InferenceMode.ENABLED;
    if (PsiUtil.canBeOverridden(method)) {
      PsiClass containingClass = method.getContainingClass();
      if (containingClass != null && (PsiUtil.isLocalClass(containingClass) || 
                                      !containingClass.isInterface() && containingClass.hasModifierProperty(PsiModifier.PRIVATE))) {
        if (ClassInheritorsSearch.search(containingClass, new LocalSearchScope(containingClass.getContainingFile()), false)
              .findFirst() == null) {
          return InferenceMode.ENABLED;
        }
      }
      return InferenceMode.PARAMETERS;
    }
    if (isUnusedInAnonymousClass(method)) return InferenceMode.DISABLED;

    return InferenceMode.ENABLED;
  }
private static InferenceMode getInferenceMode(@NotNull PsiMethodImpl method)