Lines 84-97
Link Here
|
84 |
* them back as part of the compilation unit result. |
84 |
* them back as part of the compilation unit result. |
85 |
*/ |
85 |
*/ |
86 |
public Compiler( |
86 |
public Compiler( |
87 |
INameEnvironment environment, |
87 |
INameEnvironment environment, |
88 |
IErrorHandlingPolicy policy, |
88 |
IErrorHandlingPolicy policy, |
89 |
Map settings, |
89 |
Map settings, |
90 |
final ICompilerRequestor requestor, |
90 |
final ICompilerRequestor requestor, |
91 |
IProblemFactory problemFactory, |
91 |
IProblemFactory problemFactory) { |
92 |
boolean statementsRecovery) { |
92 |
this(environment, policy, new CompilerOptions(settings), requestor, problemFactory, null); |
93 |
this(environment, policy, settings, requestor, problemFactory, |
|
|
94 |
null, false, false, false, statementsRecovery); // all defaults |
95 |
} |
93 |
} |
96 |
|
94 |
|
97 |
/** |
95 |
/** |
Lines 126-147
Link Here
|
126 |
* order to avoid object conversions. Note that the factory is not supposed |
124 |
* order to avoid object conversions. Note that the factory is not supposed |
127 |
* to accumulate the created problems, the compiler will gather them all and hand |
125 |
* to accumulate the created problems, the compiler will gather them all and hand |
128 |
* them back as part of the compilation unit result. |
126 |
* them back as part of the compilation unit result. |
129 |
* |
127 |
* |
130 |
* @param out java.io.PrintWriter |
128 |
* @param parseLiteralExpressionsAsConstants <code>boolean</code> |
131 |
* Used by the compiler to output messages which are not related to problems, |
129 |
* This parameter is used to optimize the literals or leave them as they are in the source. |
132 |
* e.g. the information issued in verbose mode. If null, defaults to System.out |
130 |
* If you put true, "Hello" + " world" will be converted to "Hello world". |
133 |
* with automatic flushing. |
|
|
134 |
*/ |
131 |
*/ |
135 |
public Compiler( |
132 |
public Compiler( |
136 |
INameEnvironment environment, |
133 |
INameEnvironment environment, |
137 |
IErrorHandlingPolicy policy, |
134 |
IErrorHandlingPolicy policy, |
138 |
Map settings, |
135 |
Map settings, |
139 |
final ICompilerRequestor requestor, |
136 |
final ICompilerRequestor requestor, |
140 |
IProblemFactory problemFactory, |
137 |
IProblemFactory problemFactory, |
141 |
PrintWriter out, |
138 |
boolean parseLiteralExpressionsAsConstants) { |
142 |
boolean statementsRecovery) { |
139 |
this(environment, policy, new CompilerOptions(settings, parseLiteralExpressionsAsConstants), requestor, problemFactory, null); |
143 |
this(environment, policy, settings, requestor, problemFactory, out, |
|
|
144 |
false, false, false, statementsRecovery); // all defaults |
145 |
} |
140 |
} |
146 |
|
141 |
|
147 |
/** |
142 |
/** |
Lines 176-206
Link Here
|
176 |
* order to avoid object conversions. Note that the factory is not supposed |
171 |
* order to avoid object conversions. Note that the factory is not supposed |
177 |
* to accumulate the created problems, the compiler will gather them all and hand |
172 |
* to accumulate the created problems, the compiler will gather them all and hand |
178 |
* them back as part of the compilation unit result. |
173 |
* them back as part of the compilation unit result. |
179 |
* |
|
|
180 |
* @param parseLiteralExpressionsAsConstants <code>boolean</code> |
181 |
* This parameter is used to optimize the literals or leave them as they are in the source. |
182 |
* If you put true, "Hello" + " world" will be converted to "Hello world". |
183 |
* |
184 |
* @param storeAnnotations <code>boolean</code> |
185 |
* This parameter is used to tell the compiler to store annotations on |
186 |
* type bindings, or not. |
187 |
* |
188 |
* @param statementsRecovery <code>boolean</code> |
189 |
* This parameter is used to tell the compiler to perform syntax error |
190 |
* recovery on statements, or not. |
191 |
*/ |
174 |
*/ |
192 |
public Compiler( |
175 |
public Compiler( |
193 |
INameEnvironment environment, |
176 |
INameEnvironment environment, |
194 |
IErrorHandlingPolicy policy, |
177 |
IErrorHandlingPolicy policy, |
195 |
Map settings, |
178 |
CompilerOptions options, |
196 |
final ICompilerRequestor requestor, |
179 |
final ICompilerRequestor requestor, |
197 |
IProblemFactory problemFactory, |
180 |
IProblemFactory problemFactory) { |
198 |
boolean parseLiteralExpressionsAsConstants, |
181 |
this(environment, policy, options, requestor, problemFactory, null); |
199 |
boolean storeAnnotations, |
|
|
200 |
boolean statementsRecovery) { |
201 |
this(environment, policy, settings, requestor, problemFactory, |
202 |
null, // default |
203 |
parseLiteralExpressionsAsConstants, storeAnnotations, true, statementsRecovery); |
204 |
} |
182 |
} |
205 |
|
183 |
|
206 |
/** |
184 |
/** |
Lines 235-281
Link Here
|
235 |
* order to avoid object conversions. Note that the factory is not supposed |
213 |
* order to avoid object conversions. Note that the factory is not supposed |
236 |
* to accumulate the created problems, the compiler will gather them all and hand |
214 |
* to accumulate the created problems, the compiler will gather them all and hand |
237 |
* them back as part of the compilation unit result. |
215 |
* them back as part of the compilation unit result. |
238 |
* |
|
|
239 |
* @param out java.io.PrintWriter |
240 |
* Used by the compiler to output messages which are not related to problems, |
241 |
* e.g. the information issued in verbose mode. If null, defaults to System.out |
242 |
* with automatic flushing. |
243 |
* |
244 |
* @param parseLiteralExpressionsAsConstants <code>boolean</code> |
245 |
* This parameter is used to optimize the literals or leave them as they are in the source. |
246 |
* If you put true, "Hello" + " world" will be converted to "Hello world". |
247 |
* |
248 |
* @param storeAnnotations <code>boolean</code> |
249 |
* This parameter is used to tell the compiler to store annotations on |
250 |
* type bindings, or not. |
251 |
* |
252 |
* @param flag <code>boolean</code> |
253 |
* Set to true if and only if the following boolean parameters are significant: |
254 |
* <code>parseLiteralExpressionsAsConstants</code>, <code>storeAnnotations</code>. |
255 |
* |
256 |
* @param statementsRecovery <code>boolean</code> |
257 |
* This parameter is used to tell the compiler to perform syntax error |
258 |
* recovery on statements, or not. |
259 |
*/ |
216 |
*/ |
260 |
private Compiler( |
217 |
public Compiler( |
261 |
INameEnvironment environment, |
218 |
INameEnvironment environment, |
262 |
IErrorHandlingPolicy policy, |
219 |
IErrorHandlingPolicy policy, |
263 |
Map settings, |
220 |
CompilerOptions options, |
264 |
final ICompilerRequestor requestor, |
221 |
final ICompilerRequestor requestor, |
265 |
IProblemFactory problemFactory, |
222 |
IProblemFactory problemFactory, |
266 |
PrintWriter out, |
223 |
PrintWriter out) { |
267 |
boolean parseLiteralExpressionsAsConstants, |
224 |
|
268 |
boolean storeAnnotations, |
225 |
this.options = options; |
269 |
boolean flag, |
|
|
270 |
boolean statementsRecovery) { |
271 |
|
272 |
// create a problem handler given a handling policy |
273 |
this.options = new CompilerOptions(settings); |
274 |
this.options.performStatementsRecovery = statementsRecovery; |
275 |
if (flag) { // boolean parameters are significant, pass them down |
276 |
this.options.parseLiteralExpressionsAsConstants = parseLiteralExpressionsAsConstants; |
277 |
this.options.storeAnnotations = storeAnnotations; |
278 |
} |
279 |
|
226 |
|
280 |
// wrap requestor in DebugRequestor if one is specified |
227 |
// wrap requestor in DebugRequestor if one is specified |
281 |
if(DebugRequestor == null) { |
228 |
if(DebugRequestor == null) { |