/**
  * Entry point of recursive-descent IndexUnit to AScene transformer.
  *
  * @param iu {@link IndexUnit} representing stubfile
  * @return {@link AScene} containing annotations from stubfile
  */
 private static void extractScene(IndexUnit iu, AScene scene) {
   for (CompilationUnit cu : iu.getCompilationUnits()) {
     List<TypeDeclaration> typeDecls = cu.getTypes();
     if (typeDecls != null) {
       List<ImportDeclaration> impDecls = cu.getImports();
       PackageDeclaration pkgDecl = cu.getPackage();
       for (TypeDeclaration typeDecl : typeDecls) {
         ToIndexFileConverter converter = new ToIndexFileConverter(pkgDecl, impDecls, scene);
         String pkgName = converter.pkgName;
         String name = typeDecl.getName();
         if (!pkgName.isEmpty()) {
           name = pkgName + "." + name;
         }
         typeDecl.accept(converter, scene.classes.vivify(name));
       }
     }
   }
 }
Example #2
0
 @Override
 public void visit(CompilationUnit n, Object arg) {
   if (n.getPackage() != null) {
     n.getPackage().accept(this, arg);
   }
   if (n.getImports() != null) {
     for (ImportDeclaration i : n.getImports()) {
       i.accept(this, arg);
     }
     printer.printLn();
   }
   if (n.getTypes() != null) {
     for (Iterator<TypeDeclaration> i = n.getTypes().iterator(); i.hasNext(); ) {
       i.next().accept(this, arg);
       printer.printLn();
       if (i.hasNext()) {
         printer.printLn();
       }
     }
   }
 }