public static @Nullable ImportAvailability getStaticImportClass(@NotNull PsiElement element) {
    if (!PsiUtil.isAvailable(JavaFeature.STATIC_IMPORTS, element)) return null;
    if (element instanceof PsiIdentifier) {
      final PsiElement parent = element.getParent();
      if (parent instanceof PsiMethodReferenceExpression) return null;
      if (parent instanceof PsiJavaCodeReferenceElement refExpr && refExpr.getQualifier() != null) {
        if (PsiTreeUtil.getParentOfType(parent, PsiImportList.class) != null) return null;
        if (checkParameterizedReference(refExpr)) return null;
        JavaResolveResult[] results = refExpr.multiResolve(false);
        for (JavaResolveResult result : results) {
          final PsiElement resolved = result.getElement();
          if (resolved instanceof PsiMember && ((PsiModifierListOwner)resolved).hasModifierProperty(PsiModifier.STATIC) ||
              resolved instanceof PsiClass) {
            if (!PsiUtil.isAccessible((PsiMember)resolved, element.getContainingFile(), null)) return null;
            PsiClass aClass = getResolvedClass(element, (PsiMember)resolved);
            String qName = aClass != null ? aClass.getQualifiedName() : null;
            if (aClass != null &&
                qName != null &&
                !PsiTreeUtil.isAncestor(aClass, element, true) &&
                !aClass.hasModifierProperty(PsiModifier.PRIVATE) &&
                !PsiUtil.isFromDefaultPackage(aClass)) {
              final PsiElement gParent = refExpr.getParent();
              if (gParent instanceof PsiMethodCallExpression) {
                final PsiMethodCallExpression call = (PsiMethodCallExpression)gParent.copy();
                final PsiElement qualifier = call.getMethodExpression().getQualifier();
                if (qualifier == null) return null;
                qualifier.delete();
                final JavaResolveResult resolveResult = call.resolveMethodGenerics();
                final PsiElement method = resolveResult.getElement();
                if (method instanceof PsiMethod) {
                  if (((PsiMethod)method).getContainingClass() != aClass) {
                    final PsiElement currentFileResolveScope = resolveResult.getCurrentFileResolveScope();
                    if (currentFileResolveScope instanceof PsiImportStaticStatement) {
                      //don't hide another on-demand import and don't create ambiguity
                      if (resolved instanceof PsiMethod && MethodSignatureUtil.areSignaturesEqual((PsiMethod)method, (PsiMethod)resolved)) {
                        return null;
                      }
                    }
                    else return null;
                  }
                }
                else if (method == null && call.getMethodExpression().multiResolve(false).length > 0) {
                  return null;
                }
              }
              else {
                PsiElement refNameElement = refExpr.getReferenceNameElement();
                if (refNameElement == null) return null;
                final PsiJavaCodeReferenceElement copy = JavaPsiFacade.getElementFactory(refNameElement.getProject())
                  .createReferenceFromText(refNameElement.getText(), refExpr);
                final PsiElement target = copy.resolve();
                if (target != null && PsiTreeUtil.getParentOfType(target, PsiClass.class) != aClass) return null;
                if (hasTypeArguments(refExpr.getQualifier())) return null;
              }
              return new ImportAvailability(qName + "." +refExpr.getReferenceName(), (PsiMember) resolved);
            }
          }
        }
      }
    }

    return null;
  }
public static @Nullable ImportAvailability getStaticImportClass(@NotNull PsiElement element)