public static boolean hasJavaFiles(PsiDirectory... directories) {
    for (PsiDirectory directory : directories) {
      final boolean [] containsJava = new boolean[]{false};
      VfsUtil.processFileRecursivelyWithoutIgnored(directory.getVirtualFile(), file -> {
        if (FileTypeRegistry.getInstance().isFileOfType(file, JavaFileType.INSTANCE)) {
          containsJava[0] = true;
          return false;
        }
        return true;
      });
      if (containsJava[0]) return true;
    }
    return false;
  }
public static boolean hasJavaFiles(PsiDirectory... directories)