@Override
  public Comparable weigh(final @NotNull PsiElement element, final @NotNull ProximityLocation location) {
    Project project = location.getProject();
    if (project == null) return 0;

    Comparable tests = getTestFrameworkWeight(element, location, project);
    if (tests != null) return tests;

    if (element instanceof PsiMember && JavaCompletionUtil.isInExcludedPackage((PsiMember)element, false)) {
      return -1;
    }

    if (JdkUtils.getJdkForElement(element) == null) {
      return 0;
    }

    if (element instanceof PsiClass aClass) {
      return getJdkClassProximity(aClass);
    }
    if (element instanceof PsiMethod method) {
      final PsiClass containingClass = method.getContainingClass();
      if (containingClass != null) {
        String methodName = method.getName();
        if ("finalize".equals(methodName) || "registerNatives".equals(methodName) || methodName.startsWith("wait") || methodName.startsWith("notify")) {
          if (JAVA_LANG_OBJECT.equals(containingClass.getQualifiedName())) {
            return -1;
          }
        }
        if (isGetClass(method)) {
          return -1;
        }
        if ("subSequence".equals(methodName)) {
          if (JAVA_LANG_STRING.equals(containingClass.getQualifiedName())) {
            return -1;
          }
        }
        if (JAVA_LANG_OBJECT.equals(containingClass.getQualifiedName())) {
          return 0;
        }
        Integer classProximity = getJdkClassProximity(containingClass);
        if (classProximity != null && "println".equals(methodName) && method.getParameterList().getParametersCount() > 0) {
          return 1 + classProximity;
        }
        return classProximity;
      }
    }
    if (element instanceof PsiField) {
      return getJdkClassProximity(((PsiField)element).getContainingClass());
    }
    return 0;
  }
@Override
  public Comparable weigh(final @NotNull PsiElement element, final @NotNull ProximityLocation location)