JavaCompiler provides (and enforces) a use-once
method to compile a list of source files. It invokes the various
phases of the compiler to cause those source files to be
- All the files given on the command line are parsed, to build a
list of parse trees. Lexing and parsing are done with
Parser. Lexical and syntax errors will be detected here.
Note: Additional files may be parsed later, if they are found on the class/source path, and if they are newer than their matching class file.
- For each of the parse trees, their symbols are "entered", using
Enter. This will also set up a "to do" list of additional work to be done to compile those parse trees. (more...)
- If source code or stub code will be generated, a list is made (in rootClasses) of all the top level classes defined in the parse trees. This will be used later, to check whether a class being processed was directly provided on the command line or not.
- Then, for as long as there is work on the "to do" list,
JavaCompilerprocesses entries from the "to do" list. In so doing, the compiler might find additional classes that need to be processed, which may result in additional entries being added to the "to do" list. (more...)
- Print final messages.
- Return a list of class symbols, perhaps just those from final lower (may not include top level classes)