Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6431435

Tree API: source files loaded implicitly from source path

XMLWordPrintable

    • b89
    • generic
    • generic
    • Verified

      com.sun.source.util.JavacTask has a method for getting the abstract syntax trees:

          public abstract Iterable<? extends CompilationUnitTree> parse()
              throws IOException;

      Also, there is a method for analyzing which may cause source files to be loaded
      from source path:

          public abstract void analyze() throws IOException;

      Perhaps the method should be modified to return all the trees (including those
      loaded from source path):

          public abstract Iterable<? extends CompilationUnitTree> analyze()
              throws IOException;

      If a client of the API tries to collect dependency information, the code could
      follow this template:

      task.parse();
      for (CompilationUnitTree unit : task.analyze()) {
          // collect dependency information (using com.sun.source.util.TreeScanner)
      }
      task.generate();

            jjg Jonathan Gibbons
            ahe Peter Ahe
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: