public static boolean hasConflictingOnDemandImport(@NotNull PsiJavaFile file, @NotNull PsiClass psiClass, @NotNull String referenceName) {
    Collection<Import> resultList = collectNamesToImport(file, new ArrayList<>());
    String qualifiedName = psiClass.getQualifiedName();
    for (Import anImport : resultList) {
      if (anImport.isStatic() &&
          referenceName.equals(StringUtil.getShortName(anImport.name())) &&
          !StringUtil.getPackageName(anImport.name()).equals(qualifiedName)) {
        return true;
      }
    }

    PsiImportList importList = file.getImportList();
    if (importList == null) return false;
    Set<String> onDemandImportedClasses = Arrays.stream(importList.getImportStaticStatements())
      .filter(statement -> statement.isOnDemand())
      .map(statement -> statement.resolveTargetClass())
      .filter(aClass -> aClass != null)
      .map(aClass -> aClass.getQualifiedName()).collect(toSet());
    String newImport = StringUtil.getQualifiedName(qualifiedName, referenceName);
    Set<String> singleImports = findSingleImports(file, Collections.singletonList(new Import(newImport, true)), onDemandImportedClasses);

    return singleImports.contains(newImport);
  }
public static boolean hasConflictingOnDemandImport(@NotNull PsiJavaFile file, @NotNull PsiClass psiClass, @NotNull String referenceName)