private void printImports(PrintWriter out, ClassNode classNode) {
    List<String> imports = new ArrayList<String>();

    ModuleNode moduleNode = classNode.getModule();
    for (ImportNode importNode : moduleNode.getStarImports()) {
      imports.add(importNode.getPackageName());
    }

    for (ImportNode imp : moduleNode.getImports()) {
      if (imp.getAlias() == null) imports.add(imp.getType().getName());
    }

    imports.addAll(Arrays.asList(ResolveVisitor.DEFAULT_IMPORTS));

    for (String imp : imports) {
      String s =
          new StringBuilder()
              .append("import ")
              .append(imp)
              .append((imp.charAt(imp.length() - 1) == '.') ? "*;" : ";")
              .toString()
              .replace('$', '.');
      out.println(s);
    }
    out.println();
  }
  public List<ImportNode> getAllImportNodes() {
    if (sortedImports == null) {
      sortedImports = new ArrayList<ImportNode>();

      sortedImports.addAll(module.getImports());
      sortedImports.addAll(module.getStarImports());
      sortedImports.addAll(module.getStaticImports().values());
      sortedImports.addAll(module.getStaticStarImports().values());

      Collections.sort(sortedImports, new ImportNodeComparator());
      sortedImports = Collections.unmodifiableList(sortedImports);
    }
    return sortedImports;
  }
 public void visitImports(ModuleNode node) {
   if (node != null) {
     for (ImportNode importNode : node.getImports()) {
       visitAnnotations(importNode);
       importNode.visit(this);
     }
     for (ImportNode importStarNode : node.getStarImports()) {
       visitAnnotations(importStarNode);
       importStarNode.visit(this);
     }
     for (ImportNode importStaticNode : node.getStaticImports().values()) {
       visitAnnotations(importStaticNode);
       importStaticNode.visit(this);
     }
     for (ImportNode importStaticStarNode : node.getStaticStarImports().values()) {
       visitAnnotations(importStaticStarNode);
       importStaticStarNode.visit(this);
     }
   }
 }
 // not available in 1.6 stream
 public static List<ImportNode> getStarImports(ModuleNode node) {
   return node.getStarImports();
 }