1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
|
2 <!-- |
|
3 Copyright 2006 Sun Microsystems, Inc. All Rights Reserved. |
|
4 DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
5 |
|
6 This code is free software; you can redistribute it and/or modify it |
|
7 under the terms of the GNU General Public License version 2 only, as |
|
8 published by the Free Software Foundation. Sun designates this |
|
9 particular file as subject to the "Classpath" exception as provided |
|
10 by Sun in the LICENSE file that accompanied this code. |
|
11 |
|
12 This code is distributed in the hope that it will be useful, but WITHOUT |
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
15 version 2 for more details (a copy is included in the LICENSE file that |
|
16 accompanied this code). |
|
17 |
|
18 You should have received a copy of the GNU General Public License version |
|
19 2 along with this work; if not, write to the Free Software Foundation, |
|
20 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
21 |
|
22 Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
23 CA 95054 USA or visit www.sun.com if you need additional information or |
|
24 have any questions. |
|
25 --> |
|
26 |
|
27 <html> |
|
28 <head> |
|
29 <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> |
|
30 <meta name="author" content="Jonathan Gibbons"> |
|
31 <link type="text/css" rel=stylesheet href="style.css"> |
|
32 <title>JavaCompiler</title> |
|
33 </head> |
|
34 <body> |
|
35 |
|
36 <h3>com.sun.tools.javac.main.JavaCompiler</h3> |
|
37 <p> |
|
38 <code>JavaCompiler</code> provides (and enforces) a use-once method to compile a list of source files. |
|
39 It invokes the various phases of the compiler to cause those source files to be compiled. |
|
40 </p> |
|
41 <ul> |
|
42 <li>All the files given on the command line are parsed, to build a |
|
43 list of parse trees. Lexing and parsing are done with |
|
44 <a href="../../src/share/classes/com/sun/tools/javac/parser/Scanner.java" class=code>Scanner</a> and |
|
45 <a href="../../src/share/classes/com/sun/tools/javac/parser/Parser.java" class=code>Parser</a>. |
|
46 Lexical and syntax errors will be detected here. |
|
47 <p class=note> |
|
48 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. |
|
49 </p> |
|
50 </li> |
|
51 |
|
52 <li>For each of the parse trees, their symbols are "entered", using |
|
53 <a href="../../src/share/classes/com/sun/tools/javac/comp/Enter.java" class=code>Enter</a>. This will also set up a "to do" list of additional work to be done to compile those parse trees. |
|
54 <i>(<a href="Enter.html">more...</a>)</i> |
|
55 </li> |
|
56 |
|
57 <li>If source code or stub code will be generated, a list is made |
|
58 (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. |
|
59 </li> |
|
60 |
|
61 <li>Then, for as long as there is work on the "to do" list, |
|
62 <code>JavaCompiler</code> processes entries from the "to do" list. |
|
63 In so doing, the compiler might find additional classes that need to be |
|
64 processed, which may result in additional entries being added to the |
|
65 "to do" list. <i>(<a href="ToDo.html">more...</a>)</i> |
|
66 </li> |
|
67 |
|
68 <li>Print final messages.</li> |
|
69 |
|
70 <li>Return a list of class symbols, perhaps just those from |
|
71 final lower (may not include top level classes) |
|
72 </li> |
|
73 </ul> |
|
74 |
|
75 |
|
76 |
|
77 </body> |
|
78 </html> |
|
79 |
|