Tue, 11 Aug 2009 01:13:14 +0100
6521805: Regression: JDK5/JDK6 javac allows write access to outer class reference
Summary: javac should warn/complain about identifiers with the same name as synthetic symbol
Reviewed-by: jjg
1 /*
2 * Copyright 2000-2008 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Sun designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Sun in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22 * CA 95054 USA or visit www.sun.com if you need additional information or
23 * have any questions.
24 */
26 package com.sun.tools.javadoc;
28 import java.io.PrintWriter;
30 /**
31 * Provides external entry points (tool and programmatic)
32 * for the javadoc program.
33 *
34 * @since 1.4
35 */
36 public class Main {
38 /**
39 * Constructor should never be called.
40 */
41 private Main() {
42 }
44 /**
45 * Command line interface.
46 * @param args The command line parameters.
47 */
48 public static void main(String... args) {
49 System.exit(execute(args));
50 }
52 /**
53 * Programmatic interface.
54 * @param args The command line parameters.
55 * @return The return code.
56 */
57 public static int execute(String... args) {
58 Start jdoc = new Start();
59 return jdoc.begin(args);
60 }
62 /**
63 * Programmatic interface.
64 * @param args The command line parameters.
65 * @param docletParentClassLoader The parent class loader used when
66 * creating the doclet classloader. If null, the class loader used
67 * to instantiate doclets will be created without specifying a parent
68 * class loader.
69 * @return The return code.
70 * @since 1.7
71 */
72 public static int execute(ClassLoader docletParentClassLoader, String... args) {
73 Start jdoc = new Start(docletParentClassLoader);
74 return jdoc.begin(args);
75 }
77 /**
78 * Programmatic interface.
79 * @param programName Name of the program (for error messages).
80 * @param args The command line parameters.
81 * @return The return code.
82 */
83 public static int execute(String programName, String... args) {
84 Start jdoc = new Start(programName);
85 return jdoc.begin(args);
86 }
88 /**
89 * Programmatic interface.
90 * @param programName Name of the program (for error messages).
91 * @param args The command line parameters.
92 * @param docletParentClassLoader The parent class loader used when
93 * creating the doclet classloader. If null, the class loader used
94 * to instantiate doclets will be created without specifying a parent
95 * class loader.
96 * @return The return code.
97 * @since 1.7
98 */
99 public static int execute(String programName, ClassLoader docletParentClassLoader, String... args) {
100 Start jdoc = new Start(programName, docletParentClassLoader);
101 return jdoc.begin(args);
102 }
104 /**
105 * Programmatic interface.
106 * @param programName Name of the program (for error messages).
107 * @param defaultDocletClassName Fully qualified class name.
108 * @param args The command line parameters.
109 * @return The return code.
110 */
111 public static int execute(String programName,
112 String defaultDocletClassName,
113 String... args) {
114 Start jdoc = new Start(programName, defaultDocletClassName);
115 return jdoc.begin(args);
116 }
118 /**
119 * Programmatic interface.
120 * @param programName Name of the program (for error messages).
121 * @param defaultDocletClassName Fully qualified class name.
122 * @param docletParentClassLoader The parent class loader used when
123 * creating the doclet classloader. If null, the class loader used
124 * to instantiate doclets will be created without specifying a parent
125 * class loader.
126 * @param args The command line parameters.
127 * @return The return code.
128 * @since 1.7
129 */
130 public static int execute(String programName,
131 String defaultDocletClassName,
132 ClassLoader docletParentClassLoader,
133 String... args) {
134 Start jdoc = new Start(programName, defaultDocletClassName, docletParentClassLoader);
135 return jdoc.begin(args);
136 }
138 /**
139 * Programmatic interface.
140 * @param programName Name of the program (for error messages).
141 * @param errWriter PrintWriter to receive error messages.
142 * @param warnWriter PrintWriter to receive error messages.
143 * @param noticeWriter PrintWriter to receive error messages.
144 * @param defaultDocletClassName Fully qualified class name.
145 * @param args The command line parameters.
146 * @return The return code.
147 */
148 public static int execute(String programName,
149 PrintWriter errWriter,
150 PrintWriter warnWriter,
151 PrintWriter noticeWriter,
152 String defaultDocletClassName,
153 String... args) {
154 Start jdoc = new Start(programName,
155 errWriter, warnWriter, noticeWriter,
156 defaultDocletClassName);
157 return jdoc.begin(args);
158 }
160 /**
161 * Programmatic interface.
162 * @param programName Name of the program (for error messages).
163 * @param errWriter PrintWriter to receive error messages.
164 * @param warnWriter PrintWriter to receive error messages.
165 * @param noticeWriter PrintWriter to receive error messages.
166 * @param defaultDocletClassName Fully qualified class name.
167 * @param docletParentClassLoader The parent class loader used when
168 * creating the doclet classloader. If null, the class loader used
169 * to instantiate doclets will be created without specifying a parent
170 * class loader.
171 * @param args The command line parameters.
172 * @return The return code.
173 * @since 1.7
174 */
175 public static int execute(String programName,
176 PrintWriter errWriter,
177 PrintWriter warnWriter,
178 PrintWriter noticeWriter,
179 String defaultDocletClassName,
180 ClassLoader docletParentClassLoader,
181 String... args) {
182 Start jdoc = new Start(programName,
183 errWriter, warnWriter, noticeWriter,
184 defaultDocletClassName,
185 docletParentClassLoader);
186 return jdoc.begin(args);
187 }
188 }