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

JavacProcessingEnvironment does not enter trees from preceding rounds

XMLWordPrintable

    • b91
    • generic
    • generic
    • Verified

      JavacProcessing environment does not appear to enter the trees from the preceding rounds. It works as well as it does because the files get reparsed when possible from the source path, but that can't happen if they're given on the command line.

      Here is an extract from the email....

      >
      > I'm looking at code around line 744, in the lines in doProcessing after
      > you create a context for the next round.
      >
      > ... you create a fresh compiler
      > ... you parse the newly generated files (only)
      > ... you enter the trees from those parsed files
      >
      > ... you get (just) the topLevelClasses from those parsed files
      > ... you take note of any generated classes
      > ... etc
      >
      > At no point did you re-enter the cleaned trees from the previous
      > rounds! (Indeed, cleanTrees is only used once, to clean the trees for
      > the final round.)
      >
      > This explains why in my test example I have to put -sourcepath . on the
      > command line so that when it tries to compile the generated file, it has
      > access to the files I gave on the command line. (its a hack that works
      > in this case). But it showed up as an anomaly in javacviewer because
      > the command line file was being read twice, and with different paths
      > (the second has an extra ./ in the path.)
      >
      > This may be another way of aspect of the same issue. Neither do you
      > accumulate trees along the way, hence the TODO near the end of
      > doProcessing to avoid parsing files again.
      >
      > I think you should maintain a list of trees, initialized to roots, that
      > you build up in each round, and in each round, you should enter these
      > trees before you enter the trees for any newly parsed files.
      >
      >

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: