View | Details | Raw Unified | Return to bug 310330 | Differences between
and this patch

Collapse All | Expand All

(-)antadapter/org/eclipse/jdt/core/JDTCompilerAdapter.java (-96 / +97 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2009 IBM Corporation and others.
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 107-169 Link Here
107
		 */
107
		 */
108
		cmd.createArgument().setValue("-noExit"); //$NON-NLS-1$
108
		cmd.createArgument().setValue("-noExit"); //$NON-NLS-1$
109
109
110
        if (this.bootclasspath != null) {
110
		if (this.bootclasspath != null) {
111
			cmd.createArgument().setValue("-bootclasspath"); //$NON-NLS-1$
111
			cmd.createArgument().setValue("-bootclasspath"); //$NON-NLS-1$
112
        	if (this.bootclasspath.size() != 0) {
112
			if (this.bootclasspath.size() != 0) {
113
    			/*
113
				/*
114
    			 * Set the bootclasspath for the Eclipse compiler.
114
				 * Set the bootclasspath for the Eclipse compiler.
115
    			 */
115
				 */
116
    			cmd.createArgument().setPath(this.bootclasspath);
116
				cmd.createArgument().setPath(this.bootclasspath);
117
        	} else {
117
			} else {
118
    			cmd.createArgument().setValue(Util.EMPTY_STRING);
118
				cmd.createArgument().setValue(Util.EMPTY_STRING);
119
        	}
119
			}
120
        }
120
		}
121
121
122
        Path classpath = new Path(this.project);
122
		Path classpath = new Path(this.project);
123
123
124
       /*
124
		/*
125
         * Eclipse compiler doesn't support -extdirs.
125
		 * Eclipse compiler doesn't support -extdirs.
126
         * It is emulated using the classpath. We add extdirs entries after the
126
		 * It is emulated using the classpath. We add extdirs entries after the
127
         * bootclasspath.
127
		 * bootclasspath.
128
         */
128
		 */
129
        if (this.extdirs != null) {
129
		if (this.extdirs != null) {
130
			cmd.createArgument().setValue("-extdirs"); //$NON-NLS-1$
130
			cmd.createArgument().setValue("-extdirs"); //$NON-NLS-1$
131
			cmd.createArgument().setPath(this.extdirs);
131
			cmd.createArgument().setPath(this.extdirs);
132
        }
132
		}
133
133
134
		/*
134
		/*
135
		 * The java runtime is already handled, so we simply want to retrieve the
135
		 * The java runtime is already handled, so we simply want to retrieve the
136
		 * ant runtime and the compile classpath.
136
		 * ant runtime and the compile classpath.
137
		 */
137
		 */
138
        classpath.append(getCompileClasspath());
138
		classpath.append(getCompileClasspath());
139
140
		// For -sourcepath, use the "sourcepath" value if present.
141
		// Otherwise default to the "srcdir" value.
142
		Path sourcepath = null;
139
143
140
        // For -sourcepath, use the "sourcepath" value if present.
144
		// retrieve the method getSourcepath() using reflect
141
        // Otherwise default to the "srcdir" value.
145
		// This is done to improve the compatibility to ant 1.5
142
        Path sourcepath = null;
146
		Method getSourcepathMethod = null;
143
147
		try {
144
        // retrieve the method getSourcepath() using reflect
148
			getSourcepathMethod = javacClass.getMethod("getSourcepath", null); //$NON-NLS-1$
145
        // This is done to improve the compatibility to ant 1.5
149
		} catch(NoSuchMethodException e) {
146
        Method getSourcepathMethod = null;
150
			// if not found, then we cannot use this method (ant 1.5)
147
        try {
151
		}
148
	        getSourcepathMethod = javacClass.getMethod("getSourcepath", null); //$NON-NLS-1$
152
		Path compileSourcePath = null;
149
        } catch(NoSuchMethodException e) {
153
		if (getSourcepathMethod != null) {
150
        	// if not found, then we cannot use this method (ant 1.5)
154
			try {
151
        }
152
        Path compileSourcePath = null;
153
        if (getSourcepathMethod != null) {
154
	 		try {
155
				compileSourcePath = (Path) getSourcepathMethod.invoke(this.attributes, null);
155
				compileSourcePath = (Path) getSourcepathMethod.invoke(this.attributes, null);
156
			} catch (IllegalAccessException e) {
156
			} catch (IllegalAccessException e) {
157
				// should never happen
157
				// should never happen
158
			} catch (InvocationTargetException e) {
158
			} catch (InvocationTargetException e) {
159
				// should never happen
159
				// should never happen
160
			}
160
			}
161
        }
161
		}
162
        if (compileSourcePath != null) {
162
		if (compileSourcePath != null) {
163
            sourcepath = compileSourcePath;
163
			sourcepath = compileSourcePath;
164
        } else {
164
		} else {
165
            sourcepath = this.src;
165
			sourcepath = this.src;
166
        }
166
		}
167
		classpath.append(sourcepath);
167
		classpath.append(sourcepath);
168
		/*
168
		/*
169
		 * Set the classpath for the Eclipse compiler.
169
		 * Set the classpath for the Eclipse compiler.
Lines 171-208 Link Here
171
		cmd.createArgument().setValue("-classpath"); //$NON-NLS-1$
171
		cmd.createArgument().setValue("-classpath"); //$NON-NLS-1$
172
		createClasspathArgument(cmd, classpath);
172
		createClasspathArgument(cmd, classpath);
173
173
174
        final String javaVersion = JavaEnvUtils.getJavaVersion();
174
		final String javaVersion = JavaEnvUtils.getJavaVersion();
175
		String memoryParameterPrefix = javaVersion.equals(JavaEnvUtils.JAVA_1_1) ? "-J-" : "-J-X";//$NON-NLS-1$//$NON-NLS-2$
175
		String memoryParameterPrefix = javaVersion.equals(JavaEnvUtils.JAVA_1_1) ? "-J-" : "-J-X";//$NON-NLS-1$//$NON-NLS-2$
176
        if (this.memoryInitialSize != null) {
176
		if (this.memoryInitialSize != null) {
177
            if (!this.attributes.isForkedJavac()) {
177
			if (!this.attributes.isForkedJavac()) {
178
                this.attributes.log(AntAdapterMessages.getString("ant.jdtadapter.info.ignoringMemoryInitialSize"), Project.MSG_WARN); //$NON-NLS-1$
178
				this.attributes.log(AntAdapterMessages.getString("ant.jdtadapter.info.ignoringMemoryInitialSize"), Project.MSG_WARN); //$NON-NLS-1$
179
            } else {
179
			} else {
180
                cmd.createArgument().setValue(memoryParameterPrefix
180
				cmd.createArgument().setValue(memoryParameterPrefix
181
                                              + "ms" + this.memoryInitialSize); //$NON-NLS-1$
181
						+ "ms" + this.memoryInitialSize); //$NON-NLS-1$
182
            }
182
			}
183
        }
183
		}
184
184
185
        if (this.memoryMaximumSize != null) {
185
		if (this.memoryMaximumSize != null) {
186
            if (!this.attributes.isForkedJavac()) {
186
			if (!this.attributes.isForkedJavac()) {
187
                this.attributes.log(AntAdapterMessages.getString("ant.jdtadapter.info.ignoringMemoryMaximumSize"), Project.MSG_WARN); //$NON-NLS-1$
187
				this.attributes.log(AntAdapterMessages.getString("ant.jdtadapter.info.ignoringMemoryMaximumSize"), Project.MSG_WARN); //$NON-NLS-1$
188
            } else {
188
			} else {
189
                cmd.createArgument().setValue(memoryParameterPrefix
189
				cmd.createArgument().setValue(memoryParameterPrefix
190
                                              + "mx" + this.memoryMaximumSize); //$NON-NLS-1$
190
						+ "mx" + this.memoryMaximumSize); //$NON-NLS-1$
191
            }
191
			}
192
        }
192
		}
193
193
194
        if (this.debug) {
194
		if (this.debug) {
195
	       // retrieve the method getSourcepath() using reflect
195
			// retrieve the method getSourcepath() using reflect
196
	        // This is done to improve the compatibility to ant 1.5
196
			// This is done to improve the compatibility to ant 1.5
197
	        Method getDebugLevelMethod = null;
197
			Method getDebugLevelMethod = null;
198
	        try {
198
			try {
199
		        getDebugLevelMethod = javacClass.getMethod("getDebugLevel", null); //$NON-NLS-1$
199
				getDebugLevelMethod = javacClass.getMethod("getDebugLevel", null); //$NON-NLS-1$
200
	        } catch(NoSuchMethodException e) {
200
			} catch(NoSuchMethodException e) {
201
	        	// if not found, then we cannot use this method (ant 1.5)
201
				// if not found, then we cannot use this method (ant 1.5)
202
	        	// debug level is only available with ant 1.5.x
202
				// debug level is only available with ant 1.5.x
203
	        }
203
			}
204
     	    String debugLevel = null;
204
			String debugLevel = null;
205
	        if (getDebugLevelMethod != null) {
205
			if (getDebugLevelMethod != null) {
206
				try {
206
				try {
207
					debugLevel = (String) getDebugLevelMethod.invoke(this.attributes, null);
207
					debugLevel = (String) getDebugLevelMethod.invoke(this.attributes, null);
208
				} catch (IllegalAccessException e) {
208
				} catch (IllegalAccessException e) {
Lines 210-216 Link Here
210
				} catch (InvocationTargetException e) {
210
				} catch (InvocationTargetException e) {
211
					// should never happen
211
					// should never happen
212
				}
212
				}
213
        	}
213
			}
214
			if (debugLevel != null) {
214
			if (debugLevel != null) {
215
				this.customDefaultOptions.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.DO_NOT_GENERATE);
215
				this.customDefaultOptions.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.DO_NOT_GENERATE);
216
				this.customDefaultOptions.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.DO_NOT_GENERATE);
216
				this.customDefaultOptions.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.DO_NOT_GENERATE);
Lines 230-247 Link Here
230
				this.customDefaultOptions.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE);
230
				this.customDefaultOptions.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.GENERATE);
231
				this.customDefaultOptions.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.GENERATE);
231
				this.customDefaultOptions.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.GENERATE);
232
				this.customDefaultOptions.put(CompilerOptions.OPTION_SourceFileAttribute , CompilerOptions.GENERATE);
232
				this.customDefaultOptions.put(CompilerOptions.OPTION_SourceFileAttribute , CompilerOptions.GENERATE);
233
            }
233
			}
234
        } else {
234
		} else {
235
			this.customDefaultOptions.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.DO_NOT_GENERATE);
235
			this.customDefaultOptions.put(CompilerOptions.OPTION_LocalVariableAttribute, CompilerOptions.DO_NOT_GENERATE);
236
			this.customDefaultOptions.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.DO_NOT_GENERATE);
236
			this.customDefaultOptions.put(CompilerOptions.OPTION_LineNumberAttribute, CompilerOptions.DO_NOT_GENERATE);
237
			this.customDefaultOptions.put(CompilerOptions.OPTION_SourceFileAttribute , CompilerOptions.DO_NOT_GENERATE);
237
			this.customDefaultOptions.put(CompilerOptions.OPTION_SourceFileAttribute , CompilerOptions.DO_NOT_GENERATE);
238
        }
238
		}
239
239
240
		/*
240
		/*
241
		 * Handle the nowarn option. If none, then we generate all warnings.
241
		 * Handle the nowarn option. If none, then we generate all warnings.
242
		 */
242
		 */
243
		if (this.attributes.getNowarn()) {
243
		if (this.attributes.getNowarn()) {
244
	        // disable all warnings
244
			// disable all warnings
245
			Object[] entries = this.customDefaultOptions.entrySet().toArray();
245
			Object[] entries = this.customDefaultOptions.entrySet().toArray();
246
			for (int i = 0, max = entries.length; i < max; i++) {
246
			for (int i = 0, max = entries.length; i < max; i++) {
247
				Map.Entry entry = (Map.Entry) entries[i];
247
				Map.Entry entry = (Map.Entry) entries[i];
Lines 269-275 Link Here
269
			this.customDefaultOptions.put(CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, CompilerOptions.DISABLED);
269
			this.customDefaultOptions.put(CompilerOptions.OPTION_ReportDeprecationWhenOverridingDeprecatedMethod, CompilerOptions.DISABLED);
270
		}
270
		}
271
271
272
	   	/*
272
		/*
273
		 * destDir option.
273
		 * destDir option.
274
		 */
274
		 */
275
		if (this.destDir != null) {
275
		if (this.destDir != null) {
Lines 302-321 Link Here
302
		 * source option
302
		 * source option
303
		 */
303
		 */
304
		String source = this.attributes.getSource();
304
		String source = this.attributes.getSource();
305
        if (source != null) {
305
		if (source != null) {
306
			this.customDefaultOptions.put(CompilerOptions.OPTION_Source, source);
306
			this.customDefaultOptions.put(CompilerOptions.OPTION_Source, source);
307
        }
307
		}
308
309
		/*
310
		 * encoding option
311
		 */
312
        if (this.encoding != null) {
313
            cmd.createArgument().setValue("-encoding"); //$NON-NLS-1$
314
            cmd.createArgument().setValue(this.encoding);
315
        }
316
308
317
		if (compilerArgs != null) {
309
		if (compilerArgs != null) {
318
	        /*
310
			/*
319
			 * Add extra argument on the command line
311
			 * Add extra argument on the command line
320
			 */
312
			 */
321
			final int length = compilerArgs.length;
313
			final int length = compilerArgs.length;
Lines 325-341 Link Here
325
					if (this.logFileName == null && "-log".equals(arg) && ((i + 1) < max)) { //$NON-NLS-1$
317
					if (this.logFileName == null && "-log".equals(arg) && ((i + 1) < max)) { //$NON-NLS-1$
326
						this.logFileName = compilerArgs[i + 1];
318
						this.logFileName = compilerArgs[i + 1];
327
					}
319
					}
328
			        cmd.createArgument().setValue(arg);
320
					cmd.createArgument().setValue(arg);
329
				}
321
				}
330
			}
322
			}
331
	   	}
323
		}
332
     	/*
324
		/*
325
		 * encoding option. javac task encoding property must be the last encoding on the command
326
		 * line as compiler arg might also specify an encoding.
327
		 */
328
		if (this.encoding != null) {
329
			cmd.createArgument().setValue("-encoding"); //$NON-NLS-1$
330
			cmd.createArgument().setValue(this.encoding);
331
		}
332
333
		/*
333
		 * Eclipse compiler doesn't have a -sourcepath option. This is
334
		 * Eclipse compiler doesn't have a -sourcepath option. This is
334
		 * handled through the javac task that collects all source files in
335
		 * handled through the javac task that collects all source files in
335
		 * srcdir option.
336
		 * srcdir option.
336
		 */
337
		 */
337
        logAndAddFilesToCompile(cmd);
338
		logAndAddFilesToCompile(cmd);
338
        return cmd;
339
		return cmd;
339
	}
340
	}
340
341
341
	/**
342
	/**
(-)batch/org/eclipse/jdt/internal/compiler/batch/Main.java (-6 / +54 lines)
Lines 38-43 Link Here
38
import java.util.Comparator;
38
import java.util.Comparator;
39
import java.util.Date;
39
import java.util.Date;
40
import java.util.HashMap;
40
import java.util.HashMap;
41
import java.util.HashSet;
41
import java.util.Iterator;
42
import java.util.Iterator;
42
import java.util.List;
43
import java.util.List;
43
import java.util.Locale;
44
import java.util.Locale;
Lines 105-110 Link Here
105
		public static final int EMACS = 2;
106
		public static final int EMACS = 2;
106
		private static final String ERROR = "ERROR"; //$NON-NLS-1$
107
		private static final String ERROR = "ERROR"; //$NON-NLS-1$
107
		private static final String ERROR_TAG = "error"; //$NON-NLS-1$
108
		private static final String ERROR_TAG = "error"; //$NON-NLS-1$
109
		private static final String WARNING_TAG = "warning"; //$NON-NLS-1$
108
		private static final String EXCEPTION = "exception"; //$NON-NLS-1$
110
		private static final String EXCEPTION = "exception"; //$NON-NLS-1$
109
		private static final String EXTRA_PROBLEM_TAG = "extra_problem"; //$NON-NLS-1$
111
		private static final String EXTRA_PROBLEM_TAG = "extra_problem"; //$NON-NLS-1$
110
		private static final String EXTRA_PROBLEMS = "extra_problems"; //$NON-NLS-1$
112
		private static final String EXTRA_PROBLEMS = "extra_problems"; //$NON-NLS-1$
Lines 151-157 Link Here
151
		private static final String VALUE = "value"; //$NON-NLS-1$
153
		private static final String VALUE = "value"; //$NON-NLS-1$
152
		private static final String WARNING = "WARNING"; //$NON-NLS-1$
154
		private static final String WARNING = "WARNING"; //$NON-NLS-1$
153
		public static final int XML = 1;
155
		public static final int XML = 1;
154
		private static final String XML_DTD_DECLARATION = "<!DOCTYPE compiler PUBLIC \"-//Eclipse.org//DTD Eclipse JDT 3.2.003 Compiler//EN\" \"http://www.eclipse.org/jdt/core/compiler_32_003.dtd\">"; //$NON-NLS-1$
156
		private static final String XML_DTD_DECLARATION = "<!DOCTYPE compiler PUBLIC \"-//Eclipse.org//DTD Eclipse JDT 3.2.004 Compiler//EN\" \"http://www.eclipse.org/jdt/core/compiler_32_004.dtd\">"; //$NON-NLS-1$
155
		static {
157
		static {
156
			try {
158
			try {
157
				Class c = IProblem.class;
159
				Class c = IProblem.class;
Lines 723-728 Link Here
723
			this.printlnErr(error);
725
			this.printlnErr(error);
724
		}
726
		}
725
727
728
		/**
729
		 * @param message the given message
730
		 */
731
		public void logWarning(String message) {
732
			if ((this.tagBits & Logger.XML) != 0) {
733
				this.parameters.put(Logger.MESSAGE, message);
734
				printTag(Logger.WARNING_TAG, this.parameters, true, true);
735
			}
736
			this.printlnOut(message);
737
		}
738
726
		private void logProblem(CategorizedProblem problem, int localErrorCount,
739
		private void logProblem(CategorizedProblem problem, int localErrorCount,
727
			int globalErrorCount, char[] unitSource) {
740
			int globalErrorCount, char[] unitSource) {
728
			if ((this.tagBits & Logger.EMACS) != 0) {
741
			if ((this.tagBits & Logger.EMACS) != 0) {
Lines 1736-1742 Link Here
1736
	String usageSection = null;
1749
	String usageSection = null;
1737
	boolean printVersionRequired = false;
1750
	boolean printVersionRequired = false;
1738
1751
1739
	boolean didSpecifyDefaultEncoding = false;
1740
	boolean didSpecifyDeprecation = false;
1752
	boolean didSpecifyDeprecation = false;
1741
	boolean didSpecifyCompliance = false;
1753
	boolean didSpecifyCompliance = false;
1742
	boolean didSpecifyDisabledAnnotationProcessing = false;
1754
	boolean didSpecifyDisabledAnnotationProcessing = false;
Lines 1745-1750 Link Here
1745
	String customDestinationPath = null;
1757
	String customDestinationPath = null;
1746
	String currentSourceDirectory = null;
1758
	String currentSourceDirectory = null;
1747
	String currentArg = Util.EMPTY_STRING;
1759
	String currentArg = Util.EMPTY_STRING;
1760
	
1761
	Set specifiedEncodings = null;
1748
1762
1749
	// expand the command line if necessary
1763
	// expand the command line if necessary
1750
	boolean needExpansion = false;
1764
	boolean needExpansion = false;
Lines 2456-2464 Link Here
2456
				mode = DEFAULT;
2470
				mode = DEFAULT;
2457
				continue;
2471
				continue;
2458
			case INSIDE_DEFAULT_ENCODING :
2472
			case INSIDE_DEFAULT_ENCODING :
2459
				if (didSpecifyDefaultEncoding) {
2473
				if (specifiedEncodings != null) {
2460
					throw new IllegalArgumentException(
2474
					// check already defined encoding
2461
						this.bind("configure.duplicateDefaultEncoding", currentArg)); //$NON-NLS-1$
2475
					if (!specifiedEncodings.contains(currentArg)) {
2476
						if (specifiedEncodings.size() > 1) {
2477
							this.logger.logWarning(
2478
									this.bind("configure.differentencodings", //$NON-NLS-1$
2479
									currentArg,
2480
									getAllEncodings(specifiedEncodings)));
2481
						} else {
2482
							this.logger.logWarning(
2483
									this.bind("configure.differentencoding", //$NON-NLS-1$
2484
									currentArg,
2485
									getAllEncodings(specifiedEncodings)));
2486
						}
2487
					}
2488
				} else {
2489
					specifiedEncodings = new HashSet();
2462
				}
2490
				}
2463
				try { // ensure encoding is supported
2491
				try { // ensure encoding is supported
2464
					new InputStreamReader(new ByteArrayInputStream(new byte[0]), currentArg);
2492
					new InputStreamReader(new ByteArrayInputStream(new byte[0]), currentArg);
Lines 2466-2473 Link Here
2466
					throw new IllegalArgumentException(
2494
					throw new IllegalArgumentException(
2467
						this.bind("configure.unsupportedEncoding", currentArg)); //$NON-NLS-1$
2495
						this.bind("configure.unsupportedEncoding", currentArg)); //$NON-NLS-1$
2468
				}
2496
				}
2497
				specifiedEncodings.add(currentArg);
2469
				this.options.put(CompilerOptions.OPTION_Encoding, currentArg);
2498
				this.options.put(CompilerOptions.OPTION_Encoding, currentArg);
2470
				didSpecifyDefaultEncoding = true;
2471
				mode = DEFAULT;
2499
				mode = DEFAULT;
2472
				continue;
2500
				continue;
2473
			case INSIDE_DESTINATION_PATH :
2501
			case INSIDE_DESTINATION_PATH :
Lines 2724-2729 Link Here
2724
			endorsedDirClasspaths,
2752
			endorsedDirClasspaths,
2725
			customEncoding);
2753
			customEncoding);
2726
2754
2755
	if (specifiedEncodings != null && specifiedEncodings.size() > 1) {
2756
		this.logger.logWarning(this.bind("configure.multipleencodings", //$NON-NLS-1$
2757
				(String) this.options.get(CompilerOptions.OPTION_Encoding),
2758
				getAllEncodings(specifiedEncodings)));
2759
	}
2727
	if (this.pendingErrors != null) {
2760
	if (this.pendingErrors != null) {
2728
		for (Iterator iterator = this.pendingErrors.iterator(); iterator.hasNext(); ) {
2761
		for (Iterator iterator = this.pendingErrors.iterator(); iterator.hasNext(); ) {
2729
			String message = (String) iterator.next();
2762
			String message = (String) iterator.next();
Lines 2732-2737 Link Here
2732
		this.pendingErrors = null;
2765
		this.pendingErrors = null;
2733
	}
2766
	}
2734
}
2767
}
2768
private static String getAllEncodings(Set encodings) {
2769
	int size = encodings.size();
2770
	String[] allEncodings = new String[size];
2771
	encodings.toArray(allEncodings);
2772
	Arrays.sort(allEncodings);
2773
	StringBuffer buffer = new StringBuffer();
2774
	for (int i = 0; i < size; i++) {
2775
		if (i > 0) {
2776
			buffer.append(", "); //$NON-NLS-1$
2777
		}
2778
		buffer.append(allEncodings[i]);
2779
	}
2780
	return String.valueOf(buffer);
2781
}
2782
2735
private void initializeWarnings(String propertiesFile) {
2783
private void initializeWarnings(String propertiesFile) {
2736
	File file = new File(propertiesFile);
2784
	File file = new File(propertiesFile);
2737
	if (!file.exists()) {
2785
	if (!file.exists()) {
(-)batch/org/eclipse/jdt/internal/compiler/batch/messages.properties (-3 / +7 lines)
Lines 15-21 Link Here
15
#Format: compiler.name = word1 word2 word3
15
#Format: compiler.name = word1 word2 word3
16
compiler.name = Eclipse Compiler for Java(TM)
16
compiler.name = Eclipse Compiler for Java(TM)
17
#Format: compiler.version = 0.XXX[, other words (don't forget the comma if adding other words)]
17
#Format: compiler.version = 0.XXX[, other words (don't forget the comma if adding other words)]
18
compiler.version = 0.A47, 3.6.0 M7
18
compiler.version = 0.A48, 3.6.0 M7
19
compiler.copyright = Copyright IBM Corp 2000, 2010. All rights reserved.
19
compiler.copyright = Copyright IBM Corp 2000, 2010. All rights reserved.
20
20
21
### progress
21
### progress
Lines 97-102 Link Here
97
configure.multipleClasspathSections = multiple Class-Path headers in manifest of jar file: {0}
97
configure.multipleClasspathSections = multiple Class-Path headers in manifest of jar file: {0}
98
configure.missingwarningspropertiesfile=properties file {0} does not exist
98
configure.missingwarningspropertiesfile=properties file {0} does not exist
99
configure.ioexceptionwarningspropertiesfile=An IOException occurred while reading the properties file {0}
99
configure.ioexceptionwarningspropertiesfile=An IOException occurred while reading the properties file {0}
100
configure.multipleencodings=Multiple encoding specified: {1}. The default encoding has been set to {0}
101
configure.differentencodings=Found encoding {0}. Different encodings were specified: {1}
102
configure.differentencoding=Found encoding {0}. A different encoding was specified: {1}
100
103
101
### requestor
104
### requestor
102
requestor.error = {0}. ERROR in {1}
105
requestor.error = {0}. ERROR in {1}
Lines 155-163 Link Here
155
\                       created); this option can be overridden per source\n\
158
\                       created); this option can be overridden per source\n\
156
\                       directory\n\
159
\                       directory\n\
157
\    -d none            generate no .class files\n\
160
\    -d none            generate no .class files\n\
158
\    -encoding <enc>    specify custom encoding for all sources. Each\n\
161
\    -encoding <enc>    specify custom encoding for all sources. If multiple \n\
162
\                       encodings are specified, the last one will be used. Each\n\
159
\                       file/directory can override it when suffixed with\n\
163
\                       file/directory can override it when suffixed with\n\
160
\                       ''[''<enc>'']'' (e.g. X.java[utf8])\n\
164
\                       ''[''<enc>'']'' (e.g. X.java[utf8]).\n\
161
\ \n\
165
\ \n\
162
\ Compliance options:\n\
166
\ Compliance options:\n\
163
\    -1.3               use 1.3 compliance (-source 1.3 -target 1.1)\n\
167
\    -1.3               use 1.3 compliance (-source 1.3 -target 1.1)\n\
(-)schema/compiler.dtd (-1 / +3 lines)
Lines 1-9 Link Here
1
<?xml version="1.0" encoding="UTF-8"?>
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!ELEMENT compiler (error*,command_line?,options?,classpaths?,error*,sources*,extra_problems?,stats?,exception*)>
2
<!ELEMENT compiler (error*,command_line?,options?,classpaths?,error*,warning*,sources*,extra_problems?,stats?,exception*)>
3
<!ELEMENT command_line (argument*)>
3
<!ELEMENT command_line (argument*)>
4
<!ELEMENT options (option*)>
4
<!ELEMENT options (option*)>
5
<!ELEMENT classpaths (classpath+)>
5
<!ELEMENT classpaths (classpath+)>
6
<!ELEMENT error (#PCDATA)>
6
<!ELEMENT error (#PCDATA)>
7
<!ELEMENT warning (#PCDATA)>
7
<!ELEMENT sources (source+)>
8
<!ELEMENT sources (source+)>
8
<!ELEMENT source (problems*,tasks*,(classfile | error)*)>
9
<!ELEMENT source (problems*,tasks*,(classfile | error)*)>
9
<!ELEMENT problems (problem+)>
10
<!ELEMENT problems (problem+)>
Lines 68-73 Link Here
68
>
69
>
69
<!ATTLIST classfile path CDATA #REQUIRED>
70
<!ATTLIST classfile path CDATA #REQUIRED>
70
<!ATTLIST error message CDATA #REQUIRED>
71
<!ATTLIST error message CDATA #REQUIRED>
72
<!ATTLIST warning message CDATA #REQUIRED>
71
<!ATTLIST problem_summary problems CDATA #REQUIRED
73
<!ATTLIST problem_summary problems CDATA #REQUIRED
72
                          errors   CDATA #REQUIRED
74
                          errors   CDATA #REQUIRED
73
                          warnings CDATA #REQUIRED
75
                          warnings CDATA #REQUIRED
(-)src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java (-7 / +37 lines)
Lines 48-54 Link Here
48
48
49
	static {
49
	static {
50
//		TESTS_NAMES = new String[] { "test292_warn_options" };
50
//		TESTS_NAMES = new String[] { "test292_warn_options" };
51
//		TESTS_NUMBERS = new int[] { 12 };
51
//		TESTS_NUMBERS = new int[] { 306 };
52
//		TESTS_RANGE = new int[] { 298, -1 };
52
//		TESTS_RANGE = new int[] { 298, -1 };
53
	}
53
	}
54
public BatchCompilerTest(String name) {
54
public BatchCompilerTest(String name) {
Lines 1522-1532 Link Here
1522
        "                       specify location for endorsed ZIP archives\n" +
1522
        "                       specify location for endorsed ZIP archives\n" +
1523
        "    -d <dir>           destination directory (if omitted, no directory is\n" +
1523
        "    -d <dir>           destination directory (if omitted, no directory is\n" +
1524
        "                       created); this option can be overridden per source\n" +
1524
        "                       created); this option can be overridden per source\n" +
1525
		"                       directory\n" +
1525
        "                       directory\n" +
1526
		"    -d none            generate no .class files\n" +
1526
        "    -d none            generate no .class files\n" +
1527
        "    -encoding <enc>    specify custom encoding for all sources. Each\n" +
1527
        "    -encoding <enc>    specify custom encoding for all sources. If multiple \n" + 
1528
        "                       file/directory can override it when suffixed with\n" +
1528
        "                       encodings are specified, the last one will be used. Each\n" + 
1529
        "                       ''[''<enc>'']'' (e.g. X.java[utf8])\n" +
1529
        "                       file/directory can override it when suffixed with\n" + 
1530
        "                       ''[''<enc>'']'' (e.g. X.java[utf8]).\n" + 
1530
        " \n" +
1531
        " \n" +
1531
        " Compliance options:\n" +
1532
        " Compliance options:\n" +
1532
        "    -1.3               use 1.3 compliance (-source 1.3 -target 1.1)\n" +
1533
        "    -1.3               use 1.3 compliance (-source 1.3 -target 1.1)\n" +
Lines 1774-1780 Link Here
1774
		String logContents = Util.fileContent(logFileName);
1775
		String logContents = Util.fileContent(logFileName);
1775
		String expectedLogContents =
1776
		String expectedLogContents =
1776
			"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
1777
			"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
1777
			"<!DOCTYPE compiler PUBLIC \"-//Eclipse.org//DTD Eclipse JDT 3.2.003 Compiler//EN\" \"http://www.eclipse.org/jdt/core/compiler_32_003.dtd\">\n" +
1778
			"<!DOCTYPE compiler PUBLIC \"-//Eclipse.org//DTD Eclipse JDT 3.2.004 Compiler//EN\" \"http://www.eclipse.org/jdt/core/compiler_32_004.dtd\">\n" +
1778
			"<compiler copyright=\"{2}\" name=\"{1}\" version=\"{3}\">\n" +
1779
			"<compiler copyright=\"{2}\" name=\"{1}\" version=\"{3}\">\n" +
1779
			"	<command_line>\n" +
1780
			"	<command_line>\n" +
1780
			"		<argument value=\"---OUTPUT_DIR_PLACEHOLDER---{0}X.java\"/>\n" +
1781
			"		<argument value=\"---OUTPUT_DIR_PLACEHOLDER---{0}X.java\"/>\n" +
Lines 11379-11382 Link Here
11379
		"1 problem (1 error)",
11380
		"1 problem (1 error)",
11380
		true);
11381
		true);
11381
}
11382
}
11383
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=310330
11384
public void test305(){
11385
	this.runConformTest(
11386
		new String[] {
11387
			"src/X.java",
11388
			"public class X {}",
11389
		},
11390
		"\"" + OUTPUT_DIR +  File.separator + "src/X.java\""
11391
		+ " -encoding UTF-8 -1.5 -g -encoding ISO-8859-1",
11392
		"Found encoding ISO-8859-1. A different encoding was specified: UTF-8\n" + 
11393
		"Multiple encoding specified: ISO-8859-1, UTF-8. The default encoding has been set to ISO-8859-1\n",
11394
		"",
11395
		true);
11396
}
11397
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=310330
11398
public void test306(){
11399
	this.runConformTest(
11400
		new String[] {
11401
			"src/X.java",
11402
			"public class X {}",
11403
		},
11404
		"\"" + OUTPUT_DIR +  File.separator + "src/X.java\""
11405
		+ " -encoding UTF-8 -1.5 -encoding Cp1252 -g -encoding ISO-8859-1",
11406
		"Found encoding Cp1252. A different encoding was specified: UTF-8\n" + 
11407
		"Found encoding ISO-8859-1. Different encodings were specified: Cp1252, UTF-8\n" + 
11408
		"Multiple encoding specified: Cp1252, ISO-8859-1, UTF-8. The default encoding has been set to ISO-8859-1\n",
11409
		"",
11410
		true);
11411
}
11382
}
11412
}
(-)guide/jdt_api_compile.htm (-2 / +2 lines)
Lines 158-165 Link Here
158
</tr>
158
</tr>
159
<tr>
159
<tr>
160
<td valign=top width="250">-encoding &lt;encoding name&gt;</td>
160
<td valign=top width="250">-encoding &lt;encoding name&gt;</td>
161
<td colspan="3">Specify default source encoding format (custom encoding can also be specified on a per file basis by suffixing each input source file/folder name with <font color="#3366FF">[&lt;encoding name&gt;]</font>, 
161
<td colspan="3">Specify default source encoding format. If multiple encodings are specified, the last one will be used. Custom encoding can also be specified on a per file basis by suffixing each input source file/folder name with <font color="#3366FF">[&lt;encoding name&gt;]</font>, 
162
    for example <font color="#3366FF">X.java[utf8]</font>).</td>
162
    for example <font color="#3366FF">X.java[utf8]</font>.</td>
163
</tr>
163
</tr>
164
<tr>
164
<tr>
165
<th colspan="4">Compliance options</th>
165
<th colspan="4">Compliance options</th>

Return to bug 310330