View | Details | Raw Unified | Return to bug 135217
Collapse All | Expand All

(-)dom/org/eclipse/jdt/core/dom/CompilationUnitResolver.java (-8 / +12 lines)
Lines 127-139 Link Here
127
	public CompilationUnitResolver(
127
	public CompilationUnitResolver(
128
		INameEnvironment environment,
128
		INameEnvironment environment,
129
		IErrorHandlingPolicy policy,
129
		IErrorHandlingPolicy policy,
130
		Map settings,
130
		CompilerOptions compilerOptions,
131
		ICompilerRequestor requestor,
131
		ICompilerRequestor requestor,
132
		IProblemFactory problemFactory,
132
		IProblemFactory problemFactory,
133
		boolean statementsRecovery,
134
		IProgressMonitor monitor) {
133
		IProgressMonitor monitor) {
135
134
136
		super(environment, policy, settings, requestor, problemFactory, false, true/*store annotations in the bindings*/, statementsRecovery);
135
		super(environment, policy, compilerOptions, requestor, problemFactory);
137
		this.hasCompilationAborted = false;
136
		this.hasCompilationAborted = false;
138
		this.monitor =monitor;
137
		this.monitor =monitor;
139
	}
138
	}
Lines 258-263 Link Here
258
		return compilationUnit;
257
		return compilationUnit;
259
	}
258
	}
260
	
259
	
260
	protected static CompilerOptions getCompilerOptions(Map options, boolean statementsRecovery) {
261
		CompilerOptions compilerOptions = new CompilerOptions(options);
262
		compilerOptions.performStatementsRecovery = statementsRecovery;
263
		compilerOptions.parseLiteralExpressionsAsConstants = false;
264
		compilerOptions.storeAnnotations = true /*store annotations in the bindings*/;
265
		return compilerOptions;
266
	}
261
	/*
267
	/*
262
	 *  Low-level API performing the actual compilation
268
	 *  Low-level API performing the actual compilation
263
	 */
269
	 */
Lines 450-459 Link Here
450
				new CompilationUnitResolver(
456
				new CompilationUnitResolver(
451
					environment,
457
					environment,
452
					getHandlingPolicy(),
458
					getHandlingPolicy(),
453
					options,
459
					getCompilerOptions(options, statementsRecovery),
454
					getRequestor(),
460
					getRequestor(),
455
					problemFactory, 
461
					problemFactory, 
456
					statementsRecovery,
457
					monitor);
462
					monitor);
458
463
459
			resolver.resolve(compilationUnits, bindingKeys, requestor, apiLevel, options, owner);
464
			resolver.resolve(compilationUnits, bindingKeys, requestor, apiLevel, options, owner);
Lines 494-503 Link Here
494
				new CompilationUnitResolver(
499
				new CompilationUnitResolver(
495
					environment,
500
					environment,
496
					getHandlingPolicy(),
501
					getHandlingPolicy(),
497
					options,
502
					getCompilerOptions(options, statementsRecovery),
498
					getRequestor(),
503
					getRequestor(),
499
					problemFactory, 
504
					problemFactory,
500
					statementsRecovery,
501
					monitor);
505
					monitor);
502
506
503
			unit = 
507
			unit = 
(-)eval/org/eclipse/jdt/internal/eval/Evaluator.java (-3 / +5 lines)
Lines 24-29 Link Here
24
import org.eclipse.jdt.internal.compiler.IProblemFactory;
24
import org.eclipse.jdt.internal.compiler.IProblemFactory;
25
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
25
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit;
26
import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
26
import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
27
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
27
import org.eclipse.jdt.internal.core.util.Util;
28
import org.eclipse.jdt.internal.core.util.Util;
28
29
29
/**
30
/**
Lines 158-170 Link Here
158
 * Creates and returns a compiler for this evaluator.
159
 * Creates and returns a compiler for this evaluator.
159
 */
160
 */
160
Compiler getCompiler(ICompilerRequestor compilerRequestor) {
161
Compiler getCompiler(ICompilerRequestor compilerRequestor) {
162
	CompilerOptions compilerOptions = new CompilerOptions(this.options);
163
	compilerOptions.performStatementsRecovery = true;
161
	return new Compiler(
164
	return new Compiler(
162
		this.environment, 
165
		this.environment, 
163
		DefaultErrorHandlingPolicies.exitAfterAllProblems(), 
166
		DefaultErrorHandlingPolicies.exitAfterAllProblems(), 
164
		this.options, 
167
		compilerOptions, 
165
		compilerRequestor, 
168
		compilerRequestor, 
166
		this.problemFactory,
169
		this.problemFactory);
167
		true);
168
}
170
}
169
/**
171
/**
170
 * Builds and returns the source for the current compilation unit.
172
 * Builds and returns the source for the current compilation unit.
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetCompiler.java (-2 / +3 lines)
Lines 17-22 Link Here
17
import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy;
17
import org.eclipse.jdt.internal.compiler.IErrorHandlingPolicy;
18
import org.eclipse.jdt.internal.compiler.IProblemFactory;
18
import org.eclipse.jdt.internal.compiler.IProblemFactory;
19
import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
19
import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
20
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
20
21
21
/**
22
/**
22
 * A compiler that compiles code snippets. 
23
 * A compiler that compiles code snippets. 
Lines 33-45 Link Here
33
	public CodeSnippetCompiler(
34
	public CodeSnippetCompiler(
34
		INameEnvironment environment,
35
		INameEnvironment environment,
35
		IErrorHandlingPolicy policy,
36
		IErrorHandlingPolicy policy,
36
		Map settings,
37
		CompilerOptions compilerOptions,
37
		ICompilerRequestor requestor,
38
		ICompilerRequestor requestor,
38
		IProblemFactory problemFactory,
39
		IProblemFactory problemFactory,
39
		EvaluationContext evaluationContext,
40
		EvaluationContext evaluationContext,
40
		int codeSnippetStart,
41
		int codeSnippetStart,
41
		int codeSnippetEnd) {
42
		int codeSnippetEnd) {
42
		super(environment, policy, settings, requestor, problemFactory, true);
43
		super(environment, policy, compilerOptions, requestor, problemFactory);
43
		this.parser =
44
		this.parser =
44
			new CodeSnippetParser(
45
			new CodeSnippetParser(
45
				this.problemReporter,
46
				this.problemReporter,
(-)eval/org/eclipse/jdt/internal/eval/CodeSnippetEvaluator.java (-4 / +8 lines)
Lines 22-27 Link Here
22
import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException;
22
import org.eclipse.jdt.internal.compiler.classfmt.ClassFormatException;
23
import org.eclipse.jdt.internal.compiler.env.IBinaryType;
23
import org.eclipse.jdt.internal.compiler.env.IBinaryType;
24
import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
24
import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
25
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
25
26
26
/**
27
/**
27
 * A code snippet evaluator compiles and returns class file for a code snippet.
28
 * A code snippet evaluator compiles and returns class file for a code snippet.
Lines 115-125 Link Here
115
		// use a regular compiler and feed its lookup environment with 
116
		// use a regular compiler and feed its lookup environment with 
116
		// the code snippet support classes
117
		// the code snippet support classes
117
118
119
		CompilerOptions compilerOptions = new CompilerOptions(this.options);
120
		compilerOptions.performStatementsRecovery = true;
118
		compiler = 
121
		compiler = 
119
			new CodeSnippetCompiler(
122
			new CodeSnippetCompiler(
120
				this.environment, 
123
				this.environment, 
121
				DefaultErrorHandlingPolicies.exitAfterAllProblems(), 
124
				DefaultErrorHandlingPolicies.exitAfterAllProblems(), 
122
				this.options, 
125
				compilerOptions, 
123
				compilerRequestor, 
126
				compilerRequestor, 
124
				this.problemFactory,
127
				this.problemFactory,
125
				this.context,
128
				this.context,
Lines 149-161 Link Here
149
		// use a wrapped environment so that if the code snippet classes are not found
152
		// use a wrapped environment so that if the code snippet classes are not found
150
		// then a default implementation is provided.
153
		// then a default implementation is provided.
151
154
155
		CompilerOptions compilerOptions = new CompilerOptions(this.options);
156
		compilerOptions.performStatementsRecovery = true;
152
		compiler = new Compiler(
157
		compiler = new Compiler(
153
			getWrapperEnvironment(), 
158
			getWrapperEnvironment(), 
154
			DefaultErrorHandlingPolicies.exitAfterAllProblems(), 
159
			DefaultErrorHandlingPolicies.exitAfterAllProblems(), 
155
			this.options, 
160
			compilerOptions, 
156
			compilerRequestor, 
161
			compilerRequestor, 
157
			this.problemFactory,
162
			this.problemFactory);
158
			true);
159
	}
163
	}
160
	return compiler;
164
	return compiler;
161
}
165
}
(-)batch/org/eclipse/jdt/internal/compiler/batch/Main.java (-4 / +4 lines)
Lines 2806-2821 Link Here
2806
	this.startTime = System.currentTimeMillis();
2806
	this.startTime = System.currentTimeMillis();
2807
2807
2808
	INameEnvironment environment = getLibraryAccess();
2808
	INameEnvironment environment = getLibraryAccess();
2809
	this.compilerOptions = new CompilerOptions(this.options);
2810
	this.compilerOptions.performStatementsRecovery = false;
2809
	this.batchCompiler =
2811
	this.batchCompiler =
2810
		new Compiler(
2812
		new Compiler(
2811
			environment,
2813
			environment,
2812
			getHandlingPolicy(),
2814
			getHandlingPolicy(),
2813
			this.options,
2815
			this.compilerOptions,
2814
			getBatchRequestor(),
2816
			getBatchRequestor(),
2815
			getProblemFactory(),
2817
			getProblemFactory(),
2816
			this.out,
2818
			this.out);
2817
			false);
2818
	this.compilerOptions = this.batchCompiler.options;
2819
2819
2820
	// set the non-externally configurable options.
2820
	// set the non-externally configurable options.
2821
	this.compilerOptions.verbose = this.verbose;
2821
	this.compilerOptions.verbose = this.verbose;
(-)compiler/org/eclipse/jdt/internal/compiler/Compiler.java (-81 / +28 lines)
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) {
(-)model/org/eclipse/jdt/internal/core/CompilationUnitProblemFinder.java (-14 / +16 lines)
Lines 23-28 Link Here
23
import org.eclipse.jdt.internal.compiler.env.AccessRestriction;
23
import org.eclipse.jdt.internal.compiler.env.AccessRestriction;
24
import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
24
import org.eclipse.jdt.internal.compiler.env.INameEnvironment;
25
import org.eclipse.jdt.internal.compiler.env.ISourceType;
25
import org.eclipse.jdt.internal.compiler.env.ISourceType;
26
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
26
import org.eclipse.jdt.internal.compiler.lookup.PackageBinding;
27
import org.eclipse.jdt.internal.compiler.lookup.PackageBinding;
27
import org.eclipse.jdt.internal.compiler.parser.Parser;
28
import org.eclipse.jdt.internal.compiler.parser.Parser;
28
import org.eclipse.jdt.internal.compiler.parser.SourceTypeConverter;
29
import org.eclipse.jdt.internal.compiler.parser.SourceTypeConverter;
Lines 55-61 Link Here
55
	 *      in UI when compiling interactively.
56
	 *      in UI when compiling interactively.
56
	 *      @see org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies
57
	 *      @see org.eclipse.jdt.internal.compiler.DefaultErrorHandlingPolicies
57
	 * 
58
	 * 
58
	 *	@param settings The settings to use for the resolution.
59
	 *	@param compilerOptions The compiler options to use for the resolution.
59
	 *      
60
	 *      
60
	 *  @param requestor org.eclipse.jdt.internal.compiler.api.ICompilerRequestor
61
	 *  @param requestor org.eclipse.jdt.internal.compiler.api.ICompilerRequestor
61
	 *      Component which will receive and persist all compilation results and is intended
62
	 *      Component which will receive and persist all compilation results and is intended
Lines 73-92 Link Here
73
	protected CompilationUnitProblemFinder(
74
	protected CompilationUnitProblemFinder(
74
		INameEnvironment environment,
75
		INameEnvironment environment,
75
		IErrorHandlingPolicy policy,
76
		IErrorHandlingPolicy policy,
76
		Map settings,
77
		CompilerOptions compilerOptions,
77
		ICompilerRequestor requestor,
78
		ICompilerRequestor requestor,
78
		IProblemFactory problemFactory,
79
		IProblemFactory problemFactory) {
79
		boolean creatingAST,
80
		boolean statementsRecovery) {
81
80
82
		super(environment,
81
		super(environment,
83
			policy,
82
			policy,
84
			settings,
83
			compilerOptions,
85
			requestor,
84
			requestor,
86
			problemFactory,
85
			problemFactory
87
			!creatingAST/*parse literal expressions as constants only if not creating a DOM AST*/,
88
			creatingAST/*store annotations in the bindings if creating a DOM AST*/,
89
			statementsRecovery/*perform statements recovery during parse if creating a DOM AST*/
90
		);
86
		);
91
	}
87
	}
92
88
Lines 117-122 Link Here
117
		}
113
		}
118
	}
114
	}
119
115
116
	protected static CompilerOptions getCompilerOptions(Map settings, boolean creatingAST, boolean statementsRecovery) {
117
		CompilerOptions compilerOptions = new CompilerOptions(settings);
118
		compilerOptions.performStatementsRecovery = statementsRecovery;
119
		compilerOptions.parseLiteralExpressionsAsConstants = !creatingAST; /*parse literal expressions as constants only if not creating a DOM AST*/
120
		compilerOptions.storeAnnotations = creatingAST; /*store annotations in the bindings if creating a DOM AST*/
121
		return compilerOptions;
122
	}
123
	
120
	/*
124
	/*
121
	 *  Low-level API performing the actual compilation
125
	 *  Low-level API performing the actual compilation
122
	 */
126
	 */
Lines 157-167 Link Here
157
			problemFinder = new CompilationUnitProblemFinder(
161
			problemFinder = new CompilationUnitProblemFinder(
158
				environment,
162
				environment,
159
				getHandlingPolicy(),
163
				getHandlingPolicy(),
160
				project.getOptions(true),
164
				getCompilerOptions(project.getOptions(true), creatingAST, statementsRecovery),
161
				getRequestor(),
165
				getRequestor(),
162
				problemFactory,
166
				problemFactory);
163
				creatingAST,
164
				statementsRecovery);
165
			if (parser != null) {
167
			if (parser != null) {
166
				problemFinder.parser = parser;
168
				problemFinder.parser = parser;
167
			}
169
			}
(-)compiler/org/eclipse/jdt/internal/compiler/impl/CompilerOptions.java (+5 lines)
Lines 309-314 Link Here
309
		if (settings == null) return;
309
		if (settings == null) return;
310
		set(settings);		
310
		set(settings);		
311
	}
311
	}
312
	
313
	public CompilerOptions(Map settings, boolean parseLiteralExpressionsAsConstants){
314
		this(settings);
315
		this.parseLiteralExpressionsAsConstants = parseLiteralExpressionsAsConstants;
316
	}
312
317
313
	public Map getMap() {
318
	public Map getMap() {
314
		Map optionsMap = new HashMap(30);
319
		Map optionsMap = new HashMap(30);
(-)model/org/eclipse/jdt/internal/core/builder/AbstractImageBuilder.java (-3 / +4 lines)
Lines 418-430 Link Here
418
	}
418
	}
419
	
419
	
420
	// called once when the builder is initialized... can override if needed
420
	// called once when the builder is initialized... can override if needed
421
	CompilerOptions compilerOptions = new CompilerOptions(projectOptions);
422
	compilerOptions.performStatementsRecovery = true;
421
	Compiler newCompiler = new Compiler(
423
	Compiler newCompiler = new Compiler(
422
		nameEnvironment,
424
		nameEnvironment,
423
		DefaultErrorHandlingPolicies.proceedWithAllProblems(),
425
		DefaultErrorHandlingPolicies.proceedWithAllProblems(),
424
		projectOptions,
426
		compilerOptions,
425
		this,
427
		this,
426
		ProblemFactory.getProblemFactory(Locale.getDefault()),
428
		ProblemFactory.getProblemFactory(Locale.getDefault()));
427
		true);
428
	CompilerOptions options = newCompiler.options;
429
	CompilerOptions options = newCompiler.options;
429
430
430
	// enable the compiler reference info support
431
	// enable the compiler reference info support
(-)Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/FromPRsTest.java (-3 / +5 lines)
Lines 17-22 Link Here
17
import org.eclipse.jdt.core.tests.util.Util;
17
import org.eclipse.jdt.core.tests.util.Util;
18
import org.eclipse.jdt.internal.compiler.Compiler;
18
import org.eclipse.jdt.internal.compiler.Compiler;
19
import org.eclipse.jdt.internal.compiler.IProblemFactory;
19
import org.eclipse.jdt.internal.compiler.IProblemFactory;
20
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
20
21
21
public class FromPRsTest extends AbstractRegressionTest {
22
public class FromPRsTest extends AbstractRegressionTest {
22
public FromPRsTest(String name) {
23
public FromPRsTest(String name) {
Lines 33-46 Link Here
33
	IProblemFactory problemFactory = getProblemFactory();
34
	IProblemFactory problemFactory = getProblemFactory();
34
	Requestor requestor = new Requestor(problemFactory, OUTPUT_DIR.endsWith(File.separator) ? OUTPUT_DIR : OUTPUT_DIR + File.separator, false, null, false, false);
35
	Requestor requestor = new Requestor(problemFactory, OUTPUT_DIR.endsWith(File.separator) ? OUTPUT_DIR : OUTPUT_DIR + File.separator, false, null, false, false);
35
	
36
	
37
	CompilerOptions compilerOptions = new CompilerOptions(getCompilerOptions());
38
	compilerOptions.performStatementsRecovery = false;
36
	Compiler batchCompiler =
39
	Compiler batchCompiler =
37
		new Compiler(
40
		new Compiler(
38
			getNameEnvironment(testFiles, classLib),
41
			getNameEnvironment(testFiles, classLib),
39
			getErrorHandlingPolicy(),
42
			getErrorHandlingPolicy(),
40
			getCompilerOptions(),
43
			compilerOptions,
41
			requestor,
44
			requestor,
42
			problemFactory,
45
			problemFactory);
43
			false);
44
	batchCompiler.options.produceReferenceInfo = true;
46
	batchCompiler.options.produceReferenceInfo = true;
45
	batchCompiler.compile(Util.compilationUnits(new String[] {testFiles[0], testFiles[1]})); // feed only first file
47
	batchCompiler.compile(Util.compilationUnits(new String[] {testFiles[0], testFiles[1]})); // feed only first file
46
	
48
	
(-)src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java (-12 / +16 lines)
Lines 388-402 Link Here
388
			if (customOptions != null) {
388
			if (customOptions != null) {
389
				options.putAll(customOptions);
389
				options.putAll(customOptions);
390
			}
390
			}
391
			CompilerOptions compilerOptions = new CompilerOptions(options);
392
			compilerOptions.performStatementsRecovery = false;
391
			Compiler batchCompiler = 
393
			Compiler batchCompiler = 
392
				new Compiler(
394
				new Compiler(
393
					getNameEnvironment(new String[]{}, classLib), 
395
					getNameEnvironment(new String[]{}, classLib), 
394
					getErrorHandlingPolicy(), 
396
					getErrorHandlingPolicy(), 
395
					options,
397
					compilerOptions,
396
					requestor, 
398
					requestor, 
397
					problemFactory,
399
					problemFactory);
398
					false);
400
			compilerOptions.produceReferenceInfo = true;
399
			batchCompiler.options.produceReferenceInfo = true;
400
			try {
401
			try {
401
				batchCompiler.compile(Util.compilationUnits(testFiles)); // compile all files together
402
				batchCompiler.compile(Util.compilationUnits(testFiles)); // compile all files together
402
			} catch(RuntimeException e) {
403
			} catch(RuntimeException e) {
Lines 496-509 Link Here
496
				false, /* show category */
497
				false, /* show category */
497
				false /* show warning token*/);
498
				false /* show warning token*/);
498
		
499
		
500
		CompilerOptions compilerOptions = new CompilerOptions(getCompilerOptions());
501
		compilerOptions.performStatementsRecovery = false;
499
		Compiler batchCompiler = 
502
		Compiler batchCompiler = 
500
			new Compiler(
503
			new Compiler(
501
				getNameEnvironment(new String[]{}, classLib), 
504
				getNameEnvironment(new String[]{}, classLib), 
502
				getErrorHandlingPolicy(),
505
				getErrorHandlingPolicy(),
503
				getCompilerOptions(), 
506
				getCompilerOptions(), 
504
				requestor, 
507
				requestor, 
505
				problemFactory,
508
				problemFactory);
506
				false);
507
		batchCompiler.options.produceReferenceInfo = true;
509
		batchCompiler.options.produceReferenceInfo = true;
508
		Throwable exception = null;
510
		Throwable exception = null;
509
		try {
511
		try {
Lines 649-662 Link Here
649
			if (customOptions != null) {
651
			if (customOptions != null) {
650
				options.putAll(customOptions);
652
				options.putAll(customOptions);
651
			}
653
			}
654
			CompilerOptions compilerOptions = new CompilerOptions(options);
655
			compilerOptions.performStatementsRecovery = false;
652
			Compiler batchCompiler = 
656
			Compiler batchCompiler = 
653
				new Compiler(
657
				new Compiler(
654
					getNameEnvironment(new String[]{}, classLib), 
658
					getNameEnvironment(new String[]{}, classLib), 
655
					getErrorHandlingPolicy(), 
659
					getErrorHandlingPolicy(), 
656
					options,
660
					compilerOptions,
657
					requestor, 
661
					requestor, 
658
					problemFactory,
662
					problemFactory);
659
					false);
660
			batchCompiler.options.produceReferenceInfo = true;
663
			batchCompiler.options.produceReferenceInfo = true;
661
			Throwable exception = null;
664
			Throwable exception = null;
662
			try {
665
			try {
Lines 719-732 Link Here
719
		if (customOptions != null) {
722
		if (customOptions != null) {
720
			options.putAll(customOptions);
723
			options.putAll(customOptions);
721
		}
724
		}
725
		CompilerOptions compilerOptions = new CompilerOptions(options);
726
		compilerOptions.performStatementsRecovery = false;
722
		Compiler batchCompiler = 
727
		Compiler batchCompiler = 
723
			new Compiler(
728
			new Compiler(
724
				getNameEnvironment(new String[]{}, classLib), 
729
				getNameEnvironment(new String[]{}, classLib), 
725
				getErrorHandlingPolicy(), 
730
				getErrorHandlingPolicy(), 
726
				options,
731
				compilerOptions,
727
				requestor, 
732
				requestor, 
728
				problemFactory,
733
				problemFactory);
729
				false);
730
		batchCompiler.options.produceReferenceInfo = true;
734
		batchCompiler.options.produceReferenceInfo = true;
731
		try {
735
		try {
732
			batchCompiler.compile(Util.compilationUnits(testFiles)); // compile all files together
736
			batchCompiler.compile(Util.compilationUnits(testFiles)); // compile all files together
(-)src/org/eclipse/jdt/core/tests/util/Util.java (-3 / +4 lines)
Lines 82-95 Link Here
82
					return false;
82
					return false;
83
				}
83
				}
84
			};
84
			};
85
		CompilerOptions compilerOptions = new CompilerOptions(options);
86
		compilerOptions.performStatementsRecovery = false;
85
		Compiler batchCompiler = 
87
		Compiler batchCompiler = 
86
			new Compiler(
88
			new Compiler(
87
				nameEnvironment, 
89
				nameEnvironment, 
88
				errorHandlingPolicy, 
90
				errorHandlingPolicy, 
89
				options,
91
				compilerOptions,
90
				requestor, 
92
				requestor, 
91
				problemFactory,
93
				problemFactory);
92
				false);
93
		batchCompiler.options.produceReferenceInfo = true;
94
		batchCompiler.options.produceReferenceInfo = true;
94
		batchCompiler.compile(compilationUnits(pathsAndContents)); // compile all files together
95
		batchCompiler.compile(compilationUnits(pathsAndContents)); // compile all files together
95
		System.err.print(requestor.problemLog); // problem log empty if no problems
96
		System.err.print(requestor.problemLog); // problem log empty if no problems

Return to bug 135217