Lines 846-997
Link Here
|
846 |
// command line - help |
846 |
// command line - help |
847 |
public void test012(){ |
847 |
public void test012(){ |
848 |
final String expectedOutput = |
848 |
final String expectedOutput = |
849 |
"{0}\n" + |
849 |
"{0} {1}\n" + |
850 |
" \n" + |
850 |
"{2}\n" + |
851 |
" Usage: <options> <source files | directories>\n" + |
851 |
" \n" + |
852 |
" If directories are specified, then their source contents are compiled.\n" + |
852 |
" Usage: <options> <source files | directories>\n" + |
853 |
" Possible options are listed below. Options enabled by default are prefixed with ''+''\n" + |
853 |
" If directories are specified, then their source contents are compiled.\n" + |
854 |
" \n" + |
854 |
" Possible options are listed below. Options enabled by default are prefixed\n" + |
855 |
" Classpath options:\n" + |
855 |
" with ''+''.\n" + |
856 |
" -cp -classpath <directories and zip/jar files separated by " + File.pathSeparator + ">\n" + |
856 |
" \n" + |
857 |
" specify location for application classes and sources. Each\n" + |
857 |
" Classpath options:\n" + |
858 |
" directory or file can specify access rules for types between\n" + |
858 |
" -cp -classpath <directories and zip/jar files separated by " + File.pathSeparator + ">\n" + |
859 |
" ''['' and '']'' (e.g. [-X] to forbid access to type X, [~X] to\n" + |
859 |
" specify location for application classes and sources.\n" + |
860 |
" discourage access to type X, [+p/X:-p/*] to forbid access to all\n" + |
860 |
" Each directory or file can specify access rules for\n" + |
861 |
" types in package p but allow access to p/X)\n" + |
861 |
" types between ''['' and '']'' (e.g. [-X] to forbid\n" + |
862 |
" -bootclasspath <directories and zip/jar files separated by " + File.pathSeparator + ">\n" + |
862 |
" access to type X, [~X] to discourage access to type X,\n" + |
863 |
" specify location for system classes. Each directory or file can\n" + |
863 |
" [+p/X" + File.pathSeparator + "-p/*] to forbid access to all types in package p\n" + |
864 |
" specify access rules for types between ''['' and '']''\n" + |
864 |
" but allow access to p/X)\n" + |
865 |
" -sourcepath <directories and zip/jar files separated by " + File.pathSeparator + ">\n" + |
865 |
" -bootclasspath <directories and zip/jar files separated by " + File.pathSeparator + ">\n" + |
866 |
" specify location for application sources. Each directory or file can\n" + |
866 |
" specify location for system classes. Each directory or\n" + |
867 |
" specify access rules for types between ''['' and '']''\n" + |
867 |
" file can specify access rules for types between ''[''\n" + |
868 |
" .class files created from source files contained in a jar file are put in the\n" + |
868 |
" and '']''\n" + |
869 |
" user.dir folder in case no destination directory is specified.\n" + |
869 |
" -sourcepath <directories and zip/jar files separated by " + File.pathSeparator + ">\n" + |
870 |
" -extdirs <directories separated by " + File.pathSeparator + ">\n" + |
870 |
" specify location for application sources. Each directory\n" + |
871 |
" specify location for extension zip/jar files\n" + |
871 |
" or file can specify access rules for types between ''[''\n" + |
872 |
" -endorseddirs <directories separated by " + File.pathSeparator + ">\n" + |
872 |
" and '']''.\n" + |
873 |
" specify location for endorsed zip/jar files\n" + |
873 |
" .class files created from source files contained in a\n" + |
874 |
" -d <dir> destination directory (if omitted, no directory is created)\n" + |
874 |
" jar file are put in the user.dir folder in case no\n" + |
875 |
" -d none generate no .class files\n" + |
875 |
" destination directory is specified.\n" + |
876 |
" -encoding <enc> specify custom encoding for all sources. Each file/directory can override it\n" + |
876 |
" -extdirs <directories separated by " + File.pathSeparator + ">\n" + |
877 |
" when suffixed with ''[''<enc>'']'' (e.g. X.java[utf8])\n" + |
877 |
" specify location for extension zip/jar files\n" + |
878 |
" \n" + |
878 |
" -endorseddirs <directories separated by " + File.pathSeparator + ">\n" + |
879 |
" Compliance options:\n" + |
879 |
" specify location for endorsed zip/jar files\n" + |
880 |
" -1.3 use 1.3 compliance level (implicit -source 1.3 -target 1.1)\n" + |
880 |
" -d <dir> destination directory (if omitted, no directory is\n" + |
881 |
" -1.4 + use 1.4 compliance level (implicit -source 1.3 -target 1.2)\n" + |
881 |
" created)\n" + |
882 |
" -1.5 use 1.5 compliance level (implicit -source 1.5 -target 1.5)\n" + |
882 |
" -d none generate no .class files\n" + |
883 |
" -1.6 use 1.6 compliance level (implicit -source 1.6 -target 1.6)\n" + |
883 |
" -encoding <enc> specify custom encoding for all sources. Each\n" + |
884 |
" -source <version> set source level: 1.3 to 1.6 (or 6 or 6.0)\n" + |
884 |
" file/directory can override it when suffixed with\n" + |
885 |
" -target <version> set classfile target level: 1.1 to 1.6 (or 6 or 6.0)\n" + |
885 |
" ''[''<enc>'']'' (e.g. X.java[utf8])\n" + |
886 |
" \n" + |
886 |
" \n" + |
887 |
" Warning options:\n" + |
887 |
" Compliance options:\n" + |
888 |
" -deprecation + deprecation outside deprecated code\n" + |
888 |
" -1.3 use 1.3 compliance level (implicit -source 1.3\n" + |
889 |
" -nowarn disable all warnings\n" + |
889 |
" -target 1.1)\n" + |
890 |
" -warn:none disable all warnings\n" + |
890 |
" -1.4 + use 1.4 compliance level (implicit -source 1.3\n" + |
891 |
" -warn:<warnings separated by ,> enable exactly the listed warnings\n" + |
891 |
" -target 1.2)\n" + |
892 |
" -warn:+<warnings separated by ,> enable additional warnings\n" + |
892 |
" -1.5 use 1.5 compliance level (implicit -source 1.5\n" + |
893 |
" -warn:-<warnings separated by ,> disable specific warnings\n" + |
893 |
" -target 1.5)\n" + |
894 |
" allDeprecation deprecation including inside deprecated code\n" + |
894 |
" -1.6 use 1.6 compliance level (implicit -source 1.6\n" + |
895 |
" allJavadoc invalid or missing javadoc\n" + |
895 |
" -target 1.6)\n" + |
896 |
" assertIdentifier + ''assert'' used as identifier\n" + |
896 |
" -source <version> set source level: 1.3 to 1.6 (or 6 or 6.0)\n" + |
897 |
" boxing autoboxing conversion\n" + |
897 |
" -target <version> set classfile target level: 1.1 to 1.6 (or 6 or 6.0)\n" + |
898 |
" charConcat + char[] in String concat\n" + |
898 |
" \n" + |
899 |
" conditionAssign possible accidental boolean assignment\n" + |
899 |
" Warning options:\n" + |
900 |
" constructorName + method with constructor name\n" + |
900 |
" -deprecation + deprecation outside deprecated code\n" + |
901 |
" dep-ann missing @Deprecated annotation\n" + |
901 |
" -nowarn disable all warnings\n" + |
902 |
" deprecation + deprecation outside deprecated code\n" + |
902 |
" -warn:none disable all warnings\n" + |
903 |
" discouraged + use of types matching a discouraged access rule\n" + |
903 |
" -warn:<warnings separated by ,> enable exactly the listed warnings\n" + |
904 |
" emptyBlock undocumented empty block\n" + |
904 |
" -warn:+<warnings separated by ,> enable additional warnings\n" + |
905 |
" enumSwitch incomplete enum switch\n" + |
905 |
" -warn:-<warnings separated by ,> disable specific warnings\n" + |
906 |
" fallthrough possible fall-through case\n" + |
906 |
" allDeprecation deprecation including inside deprecated code\n" + |
907 |
" fieldHiding field hiding another variable\n" + |
907 |
" allJavadoc invalid or missing javadoc\n" + |
908 |
" finalBound type parameter with final bound\n" + |
908 |
" assertIdentifier + ''assert'' used as identifier\n" + |
909 |
" finally + finally block not completing normally\n" + |
909 |
" boxing autoboxing conversion\n" + |
910 |
" forbidden + use of types matching a forbidden access rule\n" + |
910 |
" charConcat + char[] in String concat\n" + |
911 |
" hiding macro for fieldHiding, localHiding, typeHiding and maskedCatchBlock\n" + |
911 |
" conditionAssign possible accidental boolean assignment\n" + |
912 |
" incomplete-switch same as enumSwitch\n" + |
912 |
" constructorName + method with constructor name\n" + |
913 |
" indirectStatic indirect reference to static member\n" + |
913 |
" dep-ann missing @Deprecated annotation\n" + |
914 |
" intfAnnotation + annotation type used as super interface\n" + |
914 |
" deprecation + deprecation outside deprecated code\n" + |
915 |
" intfNonInherited + interface non-inherited method compatibility\n" + |
915 |
" discouraged + use of types matching a discouraged access rule\n" + |
916 |
" javadoc invalid javadoc\n" + |
916 |
" emptyBlock undocumented empty block\n" + |
917 |
" localHiding local variable hiding another variable\n" + |
917 |
" enumSwitch incomplete enum switch\n" + |
918 |
" maskedCatchBlock + hidden catch block\n" + |
918 |
" fallthrough possible fall-through case\n" + |
919 |
" nls string literal lacking non-nls tag //$NON-NLS-<n>$\n" + |
919 |
" fieldHiding field hiding another variable\n" + |
920 |
" noEffectAssign + assignment without effect\n" + |
920 |
" finalBound type parameter with final bound\n" + |
921 |
" null missing or redundant null check\n" + |
921 |
" finally + finally block not completing normally\n" + |
922 |
" over-ann missing @Override annotation\n" + |
922 |
" forbidden + use of types matching a forbidden access rule\n" + |
923 |
" paramAssign assignment to a parameter\n" + |
923 |
" hiding macro for fieldHiding, localHiding, typeHiding and\n" + |
924 |
" pkgDefaultMethod + attempt to override package-default method\n" + |
924 |
" maskedCatchBlock\n" + |
925 |
" raw usage of raw type\n" + |
925 |
" incomplete-switch same as enumSwitch\n" + |
926 |
" semicolon unnecessary semicolon, empty statement\n" + |
926 |
" indirectStatic indirect reference to static member\n" + |
927 |
" serial + missing serialVersionUID\n" + |
927 |
" intfAnnotation + annotation type used as super interface\n" + |
928 |
" specialParamHiding constructor or setter parameter hiding another field\n" + |
928 |
" intfNonInherited + interface non-inherited method compatibility\n" + |
929 |
" static-access macro for indirectStatic and staticReceiver\n" + |
929 |
" javadoc invalid javadoc\n" + |
930 |
" staticReceiver + non-static reference to static member\n" + |
930 |
" localHiding local variable hiding another variable\n" + |
931 |
" suppress + enable @SuppressWarnings\n" + |
931 |
" maskedCatchBlock + hidden catch block\n" + |
932 |
" synthetic-access same as syntheticAccess\n" + |
932 |
" nls string literal lacking non-nls tag //$NON-NLS-<n>$\n" + |
933 |
" syntheticAccess synthetic access for innerclass\n" + |
933 |
" noEffectAssign + assignment without effect\n" + |
934 |
" tasks(<tags separated by |>) tasks identified by tags inside comments\n" + |
934 |
" null missing or redundant null check\n" + |
935 |
" typeHiding + type parameter hiding another type\n" + |
935 |
" over-ann missing @Override annotation\n" + |
936 |
" unchecked + unchecked type operation\n" + |
936 |
" paramAssign assignment to a parameter\n" + |
937 |
" unnecessaryElse unnecessary else clause\n" + |
937 |
" pkgDefaultMethod + attempt to override package-default method\n" + |
938 |
" unqualified-field-access same as unqualifiedField\n" + |
938 |
" raw usage of raw type\n" + |
939 |
" unqualifiedField unqualified reference to field\n" + |
939 |
" semicolon unnecessary semicolon, empty statement\n" + |
940 |
" unused macro for unusedArgument, unusedImport, unusedLabel,\n" + |
940 |
" serial + missing serialVersionUID\n" + |
941 |
" unusedLocal, unusedPrivate and unusedThrown\n" + |
941 |
" specialParamHiding constructor or setter parameter hiding another field\n" + |
942 |
" unusedArgument unread method parameter\n" + |
942 |
" static-access macro for indirectStatic and staticReceiver\n" + |
943 |
" unusedImport + unused import declaration\n" + |
943 |
" staticReceiver + non-static reference to static member\n" + |
944 |
" unusedLabel + unused label\n" + |
944 |
" suppress + enable @SuppressWarnings\n" + |
945 |
" unusedLocal + unread local variable\n" + |
945 |
" synthetic-access same as syntheticAccess\n" + |
946 |
" unusedPrivate + unused private member declaration\n" + |
946 |
" syntheticAccess synthetic access for innerclass\n" + |
947 |
" unusedThrown unused declared thrown exception\n" + |
947 |
" tasks(<tags separated by |>) tasks identified by tags inside comments\n" + |
948 |
" uselessTypeCheck unnecessary cast/instanceof operation\n" + |
948 |
" typeHiding + type parameter hiding another type\n" + |
949 |
" varargsCast + varargs argument need explicit cast\n" + |
949 |
" unchecked + unchecked type operation\n" + |
950 |
" warningToken + unhandled warning token in @SuppressWarnings\n" + |
950 |
" unnecessaryElse unnecessary else clause\n" + |
951 |
" \n" + |
951 |
" unqualified-field-access same as unqualifiedField\n" + |
952 |
" Debug options:\n" + |
952 |
" unqualifiedField unqualified reference to field\n" + |
953 |
" -g[:lines,vars,source] custom debug info\n" + |
953 |
" unused macro for unusedArgument, unusedImport, unusedLabel,\n" + |
954 |
" -g:lines,source + both lines table and source debug info\n" + |
954 |
" unusedLocal, unusedPrivate and unusedThrown\n" + |
955 |
" -g all debug info\n" + |
955 |
" unusedArgument unread method parameter\n" + |
956 |
" -g:none no debug info\n" + |
956 |
" unusedImport + unused import declaration\n" + |
957 |
" -preserveAllLocals preserve unused local vars for debug purpose\n" + |
957 |
" unusedLabel + unused label\n" + |
958 |
" \n" + |
958 |
" unusedLocal + unread local variable\n" + |
959 |
" Ignored options:\n" + |
959 |
" unusedPrivate + unused private member declaration\n" + |
960 |
" -J<option> pass option to virtual machine (ignored)\n" + |
960 |
" unusedThrown unused declared thrown exception\n" + |
961 |
" -X<option> specify non-standard option (ignored)\n" + |
961 |
" uselessTypeCheck unnecessary cast/instanceof operation\n" + |
962 |
" -X print non-standard options and exit (ignored)\n" + |
962 |
" varargsCast + varargs argument need explicit cast\n" + |
963 |
" -O optimize for execution time (ignored)\n" + |
963 |
" warningToken + unhandled warning token in @SuppressWarnings\n" + |
964 |
" \n" + |
964 |
" \n" + |
965 |
" Advanced options:\n" + |
965 |
" Debug options:\n" + |
966 |
" @<file> read command line arguments from file\n" + |
966 |
" -g[:lines,vars,source] custom debug info\n" + |
967 |
" -maxProblems <n> max number of problems per compilation unit (100 by default)\n" + |
967 |
" -g:lines,source + both lines table and source debug info\n" + |
968 |
" -log <file> log to a file. If the file extension is ''.xml'', then the log\n" + |
968 |
" -g all debug info\n" + |
969 |
" will be a xml file.\n" + |
969 |
" -g:none no debug info\n" + |
970 |
" -proceedOnError do not stop at first error, dumping class files with problem methods\n" + |
970 |
" -preserveAllLocals preserve unused local vars for debug purpose\n" + |
971 |
" -verbose enable verbose output\n" + |
971 |
" \n" + |
972 |
" -referenceInfo compute reference info\n" + |
972 |
" Ignored options:\n" + |
973 |
" -progress show progress (only in -log mode)\n" + |
973 |
" -J<option> pass option to virtual machine (ignored)\n" + |
974 |
" -time display speed information \n" + |
974 |
" -X<option> specify non-standard option (ignored)\n" + |
975 |
" -noExit do not call System.exit(n) at end of compilation (n==0 if no error)\n" + |
975 |
" -X print non-standard options and exit (ignored)\n" + |
976 |
" -repeat <n> repeat compilation process <n> times for perf analysis\n" + |
976 |
" -O optimize for execution time (ignored)\n" + |
977 |
" -inlineJSR inline JSR bytecode (implicit if target >= 1.5)\n" + |
977 |
" \n" + |
978 |
" -enableJavadoc consider references in javadoc\n" + |
978 |
" Advanced options:\n" + |
979 |
" -Xemacs used to enable emacs-style output\n" + |
979 |
" @<file> read command line arguments from file\n" + |
980 |
" \n" + |
980 |
" -maxProblems <n> max number of problems per compilation unit (100 by\n" + |
981 |
" -? -help print this help message\n" + |
981 |
" default)\n" + |
982 |
" -v -version print compiler version\n" + |
982 |
" -log <file> log to a file. If the file extension is ''.xml'', then\n" + |
983 |
" -showversion print compiler version and continue\n" + |
983 |
" the log will be a xml file.\n" + |
984 |
"\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"; |
985 |
|
1001 |
|
986 |
this.runConformTest( |
1002 |
this.runConformTest( |
987 |
new String[0], |
1003 |
new String[0], |
988 |
" -help -referenceInfo", |
1004 |
" -help -referenceInfo", |
989 |
MessageFormat.format(expectedOutput, new String[] { |
1005 |
MessageFormat.format(expectedOutput, new String[] { |
990 |
Main.bind("misc.version", new String[] { |
1006 |
Main.bind("compiler.name"), |
991 |
Main.bind("compiler.name"), |
1007 |
Main.bind("compiler.version"), |
992 |
Main.bind("compiler.version"), |
1008 |
Main.bind("compiler.copyright") |
993 |
Main.bind("compiler.copyright") |
1009 |
// because misc.version is mono-line - reconsider if this changes |
994 |
}), |
1010 |
// MessageFormat.format(expectedOutput, new String[] { |
|
|
1011 |
// Main.bind("misc.version", new String[] { |
1012 |
// Main.bind("compiler.name"), |
1013 |
// Main.bind("compiler.version"), |
1014 |
// Main.bind("compiler.copyright") |
1015 |
// }), |
995 |
// File.pathSeparator |
1016 |
// File.pathSeparator |
996 |
}), |
1017 |
}), |
997 |
"", true); |
1018 |
"", true); |