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

(-)src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java (-37 / +71 lines)
Lines 898-905 Link Here
898
        " \n" + 
898
        " \n" + 
899
        " Warning options:\n" + 
899
        " Warning options:\n" + 
900
        "    -deprecation     + deprecation outside deprecated code\n" + 
900
        "    -deprecation     + deprecation outside deprecated code\n" + 
901
        "    -nowarn            disable all warnings\n" + 
901
        "    -nowarn -warn:none disable all warnings\n" + 
902
        "    -warn:none         disable all warnings\n" + 
902
        "    -?:warn -help:warn display advanced warning options\n" + 
903
        " \n" + 
904
        " Debug options:\n" + 
905
        "    -g[:lines,vars,source] custom debug info\n" + 
906
        "    -g:lines,source  + both lines table and source debug info\n" + 
907
        "    -g                 all debug info\n" + 
908
        "    -g:none            no debug info\n" + 
909
        "    -preserveAllLocals preserve unused local vars for debug purpose\n" + 
910
        " \n" + 
911
        " Ignored options:\n" + 
912
        "    -J<option>         pass option to virtual machine (ignored)\n" + 
913
        "    -X<option>         specify non-standard option (ignored)\n" + 
914
        "    -X                 print non-standard options and exit (ignored)\n" + 
915
        "    -O                 optimize for execution time (ignored)\n" + 
916
        " \n" + 
917
        " Advanced options:\n" + 
918
        "    @<file>            read command line arguments from file\n" + 
919
        "    -maxProblems <n>   max number of problems per compilation unit (100 by\n" + 
920
        "                       default)\n" + 
921
        "    -log <file>        log to a file. If the file extension is ''.xml'', then\n" + 
922
        "                       the log will be a xml file.\n" + 
923
        "    -proceedOnError    do not stop at first error, dumping class files with\n" + 
924
        "                       problem methods\n" + 
925
        "    -verbose           enable verbose output\n" + 
926
        "    -referenceInfo     compute reference info\n" + 
927
        "    -progress          show progress (only in -log mode)\n" + 
928
        "    -time              display speed information \n" + 
929
        "    -noExit            do not call System.exit(n) at end of compilation (n==0\n" + 
930
        "                       if no error)\n" + 
931
        "    -repeat <n>        repeat compilation process <n> times for perf analysis\n" + 
932
        "    -inlineJSR         inline JSR bytecode (implicit if target >= 1.5)\n" + 
933
        "    -enableJavadoc     consider references in javadoc\n" + 
934
        "    -Xemacs            used to enable emacs-style output\n" + 
935
        " \n" + 
936
        "    -? -help           print this help message\n" + 
937
        "    -v -version        print compiler version\n" + 
938
        "    -showversion       print compiler version and continue\n" + 
939
        "\n";
940
941
	this.runConformTest(
942
		new String[0],
943
        " -help -referenceInfo",
944
		MessageFormat.format(expectedOutput, new String[] {
945
			Main.bind("compiler.name"),
946
			Main.bind("compiler.version"),
947
			Main.bind("compiler.copyright")
948
		// because misc.version is mono-line - reconsider if this changes
949
//		MessageFormat.format(expectedOutput, new String[] {
950
//				Main.bind("misc.version", new String[] {
951
//					Main.bind("compiler.name"),
952
//					Main.bind("compiler.version"),
953
//					Main.bind("compiler.copyright")
954
//				}),
955
				// File.pathSeparator
956
		}),
957
        "", true);
958
}
959
//command line - help
960
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=144248
961
// Progressive help text modifies the help options and messages.
962
public void test012b(){
963
	final String expectedOutput =
964
        "{0} {1}\n" + 
965
        "{2}\n" + 
966
        " \n" + 
967
        " Warning options:\n" + 
968
        "    -deprecation     + deprecation outside deprecated code\n" + 
969
        "    -nowarn -warn:none disable all warnings\n" + 
903
        "    -warn:<warnings separated by ,>    enable exactly the listed warnings\n" + 
970
        "    -warn:<warnings separated by ,>    enable exactly the listed warnings\n" + 
904
        "    -warn:+<warnings separated by ,>   enable additional warnings\n" + 
971
        "    -warn:+<warnings separated by ,>   enable additional warnings\n" + 
905
        "    -warn:-<warnings separated by ,>   disable specific warnings\n" + 
972
        "    -warn:-<warnings separated by ,>   disable specific warnings\n" + 
Lines 962-1007 Link Here
962
        "      varargsCast        + varargs argument need explicit cast\n" + 
1029
        "      varargsCast        + varargs argument need explicit cast\n" + 
963
        "      warningToken       + unhandled warning token in @SuppressWarnings\n" + 
1030
        "      warningToken       + unhandled warning token in @SuppressWarnings\n" + 
964
        " \n" + 
1031
        " \n" + 
965
        " Debug options:\n" + 
966
        "    -g[:lines,vars,source] custom debug info\n" + 
967
        "    -g:lines,source  + both lines table and source debug info\n" + 
968
        "    -g                 all debug info\n" + 
969
        "    -g:none            no debug info\n" + 
970
        "    -preserveAllLocals preserve unused local vars for debug purpose\n" + 
971
        " \n" + 
972
        " Ignored options:\n" + 
973
        "    -J<option>         pass option to virtual machine (ignored)\n" + 
974
        "    -X<option>         specify non-standard option (ignored)\n" + 
975
        "    -X                 print non-standard options and exit (ignored)\n" + 
976
        "    -O                 optimize for execution time (ignored)\n" + 
977
        " \n" + 
978
        " Advanced options:\n" + 
1032
        " Advanced options:\n" + 
979
        "    @<file>            read command line arguments from file\n" + 
1033
        "    -? -help           print the help message\n" + 
980
        "    -maxProblems <n>   max number of problems per compilation unit (100 by\n" + 
981
        "                       default)\n" + 
982
        "    -log <file>        log to a file. If the file extension is ''.xml'', then\n" + 
983
        "                       the log will be a xml file.\n" + 
984
        "    -proceedOnError    do not stop at first error, dumping class files with\n" + 
985
        "                       problem methods\n" + 
986
        "    -verbose           enable verbose output\n" + 
987
        "    -referenceInfo     compute reference info\n" + 
988
        "    -progress          show progress (only in -log mode)\n" + 
989
        "    -time              display speed information \n" + 
990
        "    -noExit            do not call System.exit(n) at end of compilation (n==0\n" + 
991
        "                       if no error)\n" + 
992
        "    -repeat <n>        repeat compilation process <n> times for perf analysis\n" + 
993
        "    -inlineJSR         inline JSR bytecode (implicit if target >= 1.5)\n" + 
994
        "    -enableJavadoc     consider references in javadoc\n" + 
995
        "    -Xemacs            used to enable emacs-style output\n" + 
996
        " \n" + 
997
        "    -? -help           print this help message\n" + 
998
        "    -v -version        print compiler version\n" + 
999
        "    -showversion       print compiler version and continue\n" + 
1000
        "\n";
1034
        "\n";
1001
1035
1002
	this.runConformTest(
1036
	this.runConformTest(
1003
		new String[0],
1037
		new String[0],
1004
        " -help -referenceInfo",
1038
        " -help:warn -referenceInfo",
1005
		MessageFormat.format(expectedOutput, new String[] {
1039
		MessageFormat.format(expectedOutput, new String[] {
1006
			Main.bind("compiler.name"),
1040
			Main.bind("compiler.name"),
1007
			Main.bind("compiler.version"),
1041
			Main.bind("compiler.version"),
(-)batch/org/eclipse/jdt/internal/compiler/batch/messages.properties (-36 / +45 lines)
Lines 146-153 Link Here
146
\ \n\
146
\ \n\
147
\ Warning options:\n\
147
\ Warning options:\n\
148
\    -deprecation     + deprecation outside deprecated code\n\
148
\    -deprecation     + deprecation outside deprecated code\n\
149
\    -nowarn            disable all warnings\n\
149
\    -nowarn -warn:none disable all warnings\n\
150
\    -warn:none         disable all warnings\n\
150
\    -?:warn -help:warn display advanced warning options\n\
151
\ \n\
152
\ Debug options:\n\
153
\    -g[:lines,vars,source] custom debug info\n\
154
\    -g:lines,source  + both lines table and source debug info\n\
155
\    -g                 all debug info\n\
156
\    -g:none            no debug info\n\
157
\    -preserveAllLocals preserve unused local vars for debug purpose\n\
158
\ \n\
159
\ Ignored options:\n\
160
\    -J<option>         pass option to virtual machine (ignored)\n\
161
\    -X<option>         specify non-standard option (ignored)\n\
162
\    -X                 print non-standard options and exit (ignored)\n\
163
\    -O                 optimize for execution time (ignored)\n\
164
\ \n\
165
\ Advanced options:\n\
166
\    @<file>            read command line arguments from file\n\
167
\    -maxProblems <n>   max number of problems per compilation unit (100 by\n\
168
\                       default)\n\
169
\    -log <file>        log to a file. If the file extension is ''.xml'', then\n\
170
\                       the log will be a xml file.\n\
171
\    -proceedOnError    do not stop at first error, dumping class files with\n\
172
\                       problem methods\n\
173
\    -verbose           enable verbose output\n\
174
\    -referenceInfo     compute reference info\n\
175
\    -progress          show progress (only in -log mode)\n\
176
\    -time              display speed information \n\
177
\    -noExit            do not call System.exit(n) at end of compilation (n==0\n\
178
\                       if no error)\n\
179
\    -repeat <n>        repeat compilation process <n> times for perf analysis\n\
180
\    -inlineJSR         inline JSR bytecode (implicit if target >= 1.5)\n\
181
\    -enableJavadoc     consider references in javadoc\n\
182
\    -Xemacs            used to enable emacs-style output\n\
183
\ \n\
184
\    -? -help           print this help message\n\
185
\    -v -version        print compiler version\n\
186
\    -showversion       print compiler version and continue\n
187
misc.usage.warn = {1} {2}\n\
188
{3}\n\
189
\ \n\
190
\ Warning options:\n\
191
\    -deprecation     + deprecation outside deprecated code\n\
192
\    -nowarn -warn:none disable all warnings\n\
151
\    -warn:<warnings separated by ,>    enable exactly the listed warnings\n\
193
\    -warn:<warnings separated by ,>    enable exactly the listed warnings\n\
152
\    -warn:+<warnings separated by ,>   enable additional warnings\n\
194
\    -warn:+<warnings separated by ,>   enable additional warnings\n\
153
\    -warn:-<warnings separated by ,>   disable specific warnings\n\
195
\    -warn:-<warnings separated by ,>   disable specific warnings\n\
Lines 210-250 Link Here
210
\      varargsCast        + varargs argument need explicit cast\n\
252
\      varargsCast        + varargs argument need explicit cast\n\
211
\      warningToken       + unhandled warning token in @SuppressWarnings\n\
253
\      warningToken       + unhandled warning token in @SuppressWarnings\n\
212
\ \n\
254
\ \n\
213
\ Debug options:\n\
214
\    -g[:lines,vars,source] custom debug info\n\
215
\    -g:lines,source  + both lines table and source debug info\n\
216
\    -g                 all debug info\n\
217
\    -g:none            no debug info\n\
218
\    -preserveAllLocals preserve unused local vars for debug purpose\n\
219
\ \n\
220
\ Ignored options:\n\
221
\    -J<option>         pass option to virtual machine (ignored)\n\
222
\    -X<option>         specify non-standard option (ignored)\n\
223
\    -X                 print non-standard options and exit (ignored)\n\
224
\    -O                 optimize for execution time (ignored)\n\
225
\ \n\
226
\ Advanced options:\n\
255
\ Advanced options:\n\
227
\    @<file>            read command line arguments from file\n\
256
\    -? -help           print the help message\n\
228
\    -maxProblems <n>   max number of problems per compilation unit (100 by\n\
229
\                       default)\n\
230
\    -log <file>        log to a file. If the file extension is ''.xml'', then\n\
231
\                       the log will be a xml file.\n\
232
\    -proceedOnError    do not stop at first error, dumping class files with\n\
233
\                       problem methods\n\
234
\    -verbose           enable verbose output\n\
235
\    -referenceInfo     compute reference info\n\
236
\    -progress          show progress (only in -log mode)\n\
237
\    -time              display speed information \n\
238
\    -noExit            do not call System.exit(n) at end of compilation (n==0\n\
239
\                       if no error)\n\
240
\    -repeat <n>        repeat compilation process <n> times for perf analysis\n\
241
\    -inlineJSR         inline JSR bytecode (implicit if target >= 1.5)\n\
242
\    -enableJavadoc     consider references in javadoc\n\
243
\    -Xemacs            used to enable emacs-style output\n\
244
\ \n\
245
\    -? -help           print this help message\n\
246
\    -v -version        print compiler version\n\
247
\    -showversion       print compiler version and continue\n
248
257
249
# templates
258
# templates
250
### access restrictions
259
### access restrictions
(-)batch/org/eclipse/jdt/internal/compiler/batch/Main.java (-9 / +24 lines)
Lines 1425-1430 Link Here
1425
	int mode = DEFAULT;
1425
	int mode = DEFAULT;
1426
	this.repetitions = 0;
1426
	this.repetitions = 0;
1427
	boolean printUsageRequired = false;
1427
	boolean printUsageRequired = false;
1428
	String usageSection = null;	
1428
	boolean printVersionRequired = false;
1429
	boolean printVersionRequired = false;
1429
	
1430
	
1430
	boolean didSpecifyDefaultEncoding = false;
1431
	boolean didSpecifyDefaultEncoding = false;
Lines 1725-1730 Link Here
1725
					mode = DEFAULT;
1726
					mode = DEFAULT;
1726
					continue;
1727
					continue;
1727
				}
1728
				}
1729
				if (currentArg.equals("-help:warn") || //$NON-NLS-1$
1730
						currentArg.equals("-?:warn")) { //$NON-NLS-1$ 
1731
					printUsageRequired = true;
1732
					usageSection = "misc.usage.warn"; //$NON-NLS-1$
1733
					continue;
1734
				}				
1728
				if (currentArg.equals("-noExit")) { //$NON-NLS-1$
1735
				if (currentArg.equals("-noExit")) { //$NON-NLS-1$
1729
					this.systemExitWhenFinished = false;
1736
					this.systemExitWhenFinished = false;
1730
					mode = DEFAULT;
1737
					mode = DEFAULT;
Lines 2389-2395 Link Here
2389
	this.logger.logVersion(printVersionRequired);
2396
	this.logger.logVersion(printVersionRequired);
2390
	
2397
	
2391
	if (printUsageRequired || filesCount == 0) {
2398
	if (printUsageRequired || filesCount == 0) {
2392
		printUsage();
2399
		if (usageSection ==  null) {
2400
			printUsage(); // default
2401
		} else {
2402
			printUsage(usageSection);
2403
		}
2393
		this.proceed = false;
2404
		this.proceed = false;
2394
		return;
2405
		return;
2395
	}
2406
	}
Lines 2957-2970 Link Here
2957
	environment.cleanup();
2968
	environment.cleanup();
2958
}
2969
}
2959
public void printUsage() {
2970
public void printUsage() {
2960
	this.logger.logUsage(Main.bind("misc.usage", //$NON-NLS-1$
2971
	printUsage("misc.usage"); //$NON-NLS-1$
2961
		new String[] {
2972
}
2962
			System.getProperty("path.separator"), //$NON-NLS-1$
2973
private void printUsage(String sectionID) {
2963
			Main.bind("compiler.name"), //$NON-NLS-1$
2974
	this.logger.logUsage(
2964
			Main.bind("compiler.version"), //$NON-NLS-1$
2975
		Main.bind(
2965
			Main.bind("compiler.copyright") //$NON-NLS-1$
2976
			sectionID,
2966
		}
2977
			new String[] {
2967
	));
2978
				System.getProperty("path.separator"), //$NON-NLS-1$
2979
				Main.bind("compiler.name"), //$NON-NLS-1$
2980
				Main.bind("compiler.version"), //$NON-NLS-1$
2981
				Main.bind("compiler.copyright") //$NON-NLS-1$
2982
			}));	
2968
	this.logger.flush();
2983
	this.logger.flush();
2969
}
2984
}
2970
2985

Return to bug 144248