Mon, 03 Jun 2013 17:24:47 -0700
8007687: javadoc -X does not include -Xdoclint
Reviewed-by: darcy
1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java Mon Jun 03 17:09:26 2013 -0700 1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ConfigurationImpl.java Mon Jun 03 17:24:47 2013 -0700 1.3 @@ -324,8 +324,19 @@ 1.4 option.startsWith("-xdoclint:")) { 1.5 return 1; 1.6 } else if (option.equals("-help")) { 1.7 + // Uugh: first, this should not be hidden inside optionLength, 1.8 + // and second, we should not be writing directly to stdout. 1.9 + // But we have no access to a DocErrorReporter, which would 1.10 + // allow use of reporter.printNotice 1.11 System.out.println(getText("doclet.usage")); 1.12 return 1; 1.13 + } else if (option.equals("-x")) { 1.14 + // Uugh: first, this should not be hidden inside optionLength, 1.15 + // and second, we should not be writing directly to stdout. 1.16 + // But we have no access to a DocErrorReporter, which would 1.17 + // allow use of reporter.printNotice 1.18 + System.out.println(getText("doclet.X.usage")); 1.19 + return 1; 1.20 } else if (option.equals("-footer") || 1.21 option.equals("-header") || 1.22 option.equals("-packagesheader") ||
2.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties Mon Jun 03 17:09:26 2013 -0700 2.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/resources/standard.properties Mon Jun 03 17:24:47 2013 -0700 2.3 @@ -186,45 +186,50 @@ 2.4 doclet.Same_package_name_used=Package name format used twice: {0} 2.5 doclet.exception_encountered=Exception encountered while processing {1}\n{0} 2.6 doclet.usage=Provided by Standard doclet:\n\ 2.7 - -d <directory> Destination directory for output files\n\ 2.8 - -use Create class and package usage pages\n\ 2.9 - -version Include @version paragraphs\n\ 2.10 - -author Include @author paragraphs\n\ 2.11 - -docfilessubdirs Recursively copy doc-file subdirectories\n\ 2.12 - -splitindex Split index into one file per letter\n\ 2.13 - -windowtitle <text> Browser window title for the documenation\n\ 2.14 - -doctitle <html-code> Include title for the overview page\n\ 2.15 - -header <html-code> Include header text for each page\n\ 2.16 - -footer <html-code> Include footer text for each page\n\ 2.17 - -top <html-code> Include top text for each page\n\ 2.18 - -bottom <html-code> Include bottom text for each page\n\ 2.19 - -link <url> Create links to javadoc output at <url>\n\ 2.20 - -linkoffline <url> <url2> Link to docs at <url> using package list at <url2>\n\ 2.21 - -excludedocfilessubdir <name1>:.. Exclude any doc-files subdirectories with given name.\n\ 2.22 - -group <name> <p1>:<p2>.. Group specified packages together in overview page\n\ 2.23 - -nocomment Supress description and tags, generate only declarations.\n\ 2.24 - -nodeprecated Do not include @deprecated information\n\ 2.25 - -noqualifier <name1>:<name2>:... Exclude the list of qualifiers from the output.\n\ 2.26 - -nosince Do not include @since information\n\ 2.27 - -notimestamp Do not include hidden time stamp\n\ 2.28 - -nodeprecatedlist Do not generate deprecated list\n\ 2.29 - -notree Do not generate class hierarchy\n\ 2.30 - -noindex Do not generate index\n\ 2.31 - -nohelp Do not generate help link\n\ 2.32 - -nonavbar Do not generate navigation bar\n\ 2.33 - -serialwarn Generate warning about @serial tag\n\ 2.34 - -tag <name>:<locations>:<header> Specify single argument custom tags\n\ 2.35 - -taglet The fully qualified name of Taglet to register\n\ 2.36 - -tagletpath The path to Taglets\n\ 2.37 - -Xdocrootparent <url> Replaces all appearances of @docRoot followed by /.. in doc comments with <url>\n\ 2.38 - -charset <charset> Charset for cross-platform viewing of generated documentation.\n\ 2.39 - -helpfile <file> Include file that help link links to\n\ 2.40 - -linksource Generate source in HTML\n\ 2.41 - -sourcetab <tab length> Specify the number of spaces each tab takes up in the source\n\ 2.42 - -keywords Include HTML meta tags with package, class and member info\n\ 2.43 - -stylesheetfile <path> File to change style of the generated documentation\n\ 2.44 - -docencoding <name> Output encoding name 2.45 +\ -d <directory> Destination directory for output files\n\ 2.46 +\ -use Create class and package usage pages\n\ 2.47 +\ -version Include @version paragraphs\n\ 2.48 +\ -author Include @author paragraphs\n\ 2.49 +\ -docfilessubdirs Recursively copy doc-file subdirectories\n\ 2.50 +\ -splitindex Split index into one file per letter\n\ 2.51 +\ -windowtitle <text> Browser window title for the documentation\n\ 2.52 +\ -doctitle <html-code> Include title for the overview page\n\ 2.53 +\ -header <html-code> Include header text for each page\n\ 2.54 +\ -footer <html-code> Include footer text for each page\n\ 2.55 +\ -top <html-code> Include top text for each page\n\ 2.56 +\ -bottom <html-code> Include bottom text for each page\n\ 2.57 +\ -link <url> Create links to javadoc output at <url>\n\ 2.58 +\ -linkoffline <url> <url2> Link to docs at <url> using package list at <url2>\n\ 2.59 +\ -excludedocfilessubdir <name1>:.. Exclude any doc-files subdirectories with given name.\n\ 2.60 +\ -group <name> <p1>:<p2>.. Group specified packages together in overview page\n\ 2.61 +\ -nocomment Suppress description and tags, generate only declarations.\n\ 2.62 +\ -nodeprecated Do not include @deprecated information\n\ 2.63 +\ -noqualifier <name1>:<name2>:... Exclude the list of qualifiers from the output.\n\ 2.64 +\ -nosince Do not include @since information\n\ 2.65 +\ -notimestamp Do not include hidden time stamp\n\ 2.66 +\ -nodeprecatedlist Do not generate deprecated list\n\ 2.67 +\ -notree Do not generate class hierarchy\n\ 2.68 +\ -noindex Do not generate index\n\ 2.69 +\ -nohelp Do not generate help link\n\ 2.70 +\ -nonavbar Do not generate navigation bar\n\ 2.71 +\ -serialwarn Generate warning about @serial tag\n\ 2.72 +\ -tag <name>:<locations>:<header> Specify single argument custom tags\n\ 2.73 +\ -taglet The fully qualified name of Taglet to register\n\ 2.74 +\ -tagletpath The path to Taglets\n\ 2.75 +\ -charset <charset> Charset for cross-platform viewing of generated documentation.\n\ 2.76 +\ -helpfile <file> Include file that help link links to\n\ 2.77 +\ -linksource Generate source in HTML\n\ 2.78 +\ -sourcetab <tab length> Specify the number of spaces each tab takes up in the source\n\ 2.79 +\ -keywords Include HTML meta tags with package, class and member info\n\ 2.80 +\ -stylesheetfile <path> File to change style of the generated documentation\n\ 2.81 +\ -docencoding <name> Specify the character encoding for the output 2.82 2.83 2.84 - 2.85 - 2.86 +# L10N: do not localize these words: all none accessibility html missing reference syntax 2.87 +doclet.X.usage=Provided by standard doclet:\n\ 2.88 +\ -Xdocrootparent <url> Replaces all appearances of @docRoot followed\n\ 2.89 +\ by /.. in doc comments with <url>\n\ 2.90 +\ -Xdoclint Enable recommended checks for problems in javadoc comments\n\ 2.91 +\ -Xdoclint:(all|none|[-]<group>) \n\ 2.92 +\ Enable or disable specific checks for problems in javadoc comments,\n\ 2.93 +\ where <group> is one of accessibility, html, missing, reference, or syntax.\n
3.1 --- a/src/share/classes/com/sun/tools/javac/resources/javac.properties Mon Jun 03 17:09:26 2013 -0700 3.2 +++ b/src/share/classes/com/sun/tools/javac/resources/javac.properties Mon Jun 03 17:24:47 2013 -0700 3.3 @@ -1,5 +1,5 @@ 3.4 # 3.5 -# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. 3.6 +# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved. 3.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.8 # 3.9 # This code is free software; you can redistribute it and/or modify it 3.10 @@ -146,11 +146,15 @@ 3.11 Enable or disable specific warnings 3.12 javac.opt.Xdoclint=\ 3.13 Enable recommended checks for problems in javadoc comments 3.14 +# L10N: do not localize: all none 3.15 javac.opt.Xdoclint.subopts = \ 3.16 - (all|[-]<group>)[/<access>] 3.17 + (all|none|[-]<group>)[/<access>] 3.18 + 3.19 +# L10N: do not localize: accessibility html missing reference syntax 3.20 +# L10N: do not localize: public protected package private 3.21 javac.opt.Xdoclint.custom=\n\ 3.22 \ Enable or disable specific checks for problems in javadoc comments,\n\ 3.23 -\ where <group> is one of accessibility, html, reference, or syntax,\n\ 3.24 +\ where <group> is one of accessibility, html, missing, reference, or syntax,\n\ 3.25 \ and <access> is one of public, protected, package, or private. 3.26 javac.opt.Xstdout=\ 3.27 Redirect standard output
4.1 --- a/src/share/classes/com/sun/tools/javadoc/Start.java Mon Jun 03 17:09:26 2013 -0700 4.2 +++ b/src/share/classes/com/sun/tools/javadoc/Start.java Mon Jun 03 17:24:47 2013 -0700 4.3 @@ -1,5 +1,5 @@ 4.4 /* 4.5 - * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 4.6 + * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 4.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.8 * 4.9 * This code is free software; you can redistribute it and/or modify it 4.10 @@ -156,21 +156,8 @@ 4.11 usage(true); 4.12 } 4.13 4.14 - 4.15 - /** 4.16 - * Usage 4.17 - */ 4.18 - private void usage(boolean exit) { 4.19 - // RFE: it would be better to replace the following with code to 4.20 - // write a header, then help for each option, then a footer. 4.21 - messager.notice("main.usage"); 4.22 - 4.23 - // let doclet print usage information (does nothing on error) 4.24 - if (docletInvoker != null) { 4.25 - docletInvoker.optionLength("-help"); 4.26 - } 4.27 - 4.28 - if (exit) exit(); 4.29 + void usage(boolean exit) { 4.30 + usage("main.usage", "-help", null, exit); 4.31 } 4.32 4.33 @Override 4.34 @@ -178,11 +165,28 @@ 4.35 Xusage(true); 4.36 } 4.37 4.38 - /** 4.39 - * Usage 4.40 - */ 4.41 - private void Xusage(boolean exit) { 4.42 - messager.notice("main.Xusage"); 4.43 + void Xusage(boolean exit) { 4.44 + usage("main.Xusage", "-X", "main.Xusage.foot", exit); 4.45 + } 4.46 + 4.47 + private void usage(String main, String doclet, String foot, boolean exit) { 4.48 + // RFE: it would be better to replace the following with code to 4.49 + // write a header, then help for each option, then a footer. 4.50 + messager.notice(main); 4.51 + 4.52 + // let doclet print usage information (does nothing on error) 4.53 + if (docletInvoker != null) { 4.54 + // RFE: this is a pretty bad way to get the doclet to show 4.55 + // help info. Moreover, the output appears on stdout, 4.56 + // and <i>not</i> on any of the standard streams passed 4.57 + // to javadoc, and in particular, not to the noticeWriter 4.58 + // But, to fix this, we need to fix the Doclet API. 4.59 + docletInvoker.optionLength(doclet); 4.60 + } 4.61 + 4.62 + if (foot != null) 4.63 + messager.notice(foot); 4.64 + 4.65 if (exit) exit(); 4.66 } 4.67
5.1 --- a/src/share/classes/com/sun/tools/javadoc/resources/javadoc.properties Mon Jun 03 17:09:26 2013 -0700 5.2 +++ b/src/share/classes/com/sun/tools/javadoc/resources/javadoc.properties Mon Jun 03 17:24:47 2013 -0700 5.3 @@ -1,5 +1,5 @@ 5.4 # 5.5 -# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. 5.6 +# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved. 5.7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.8 # 5.9 # This code is free software; you can redistribute it and/or modify it 5.10 @@ -27,35 +27,39 @@ 5.11 main.error={0} error 5.12 main.warnings={0} warnings 5.13 main.warning={0} warning 5.14 -main.usage=usage: javadoc [options] [packagenames] [sourcefiles] [@files]\n\ 5.15 - -overview <file> Read overview documentation from HTML file\n\ 5.16 - -public Show only public classes and members\n\ 5.17 - -protected Show protected/public classes and members (default)\n\ 5.18 - -package Show package/protected/public classes and members\n\ 5.19 - -private Show all classes and members\n\ 5.20 - -help Display command line options and exit\n\ 5.21 - -doclet <class> Generate output via alternate doclet\n\ 5.22 - -docletpath <path> Specify where to find doclet class files\n\ 5.23 - -sourcepath <pathlist> Specify where to find source files\n\ 5.24 - -classpath <pathlist> Specify where to find user class files\n\ 5.25 - -exclude <pkglist> Specify a list of packages to exclude\n\ 5.26 - -subpackages <subpkglist> Specify subpackages to recursively load\n\ 5.27 - -breakiterator Compute 1st sentence with BreakIterator\n\ 5.28 - -bootclasspath <pathlist> Override location of class files loaded\n\ 5.29 -\t\t\t by the bootstrap class loader\n\ 5.30 - -source <release> Provide source compatibility with specified release\n\ 5.31 - -extdirs <dirlist> Override location of installed extensions\n\ 5.32 - -verbose Output messages about what Javadoc is doing\n\ 5.33 - -locale <name> Locale to be used, e.g. en_US or en_US_WIN\n\ 5.34 - -encoding <name> Source file encoding name\n\ 5.35 - -quiet Do not display status messages\n\ 5.36 - -J<flag> Pass <flag> directly to the runtime system\n\ 5.37 - -X Print a synopsis of nonstandard options\n 5.38 + 5.39 +main.usage=Usage: javadoc [options] [packagenames] [sourcefiles] [@files]\n\ 5.40 +\ -overview <file> Read overview documentation from HTML file\n\ 5.41 +\ -public Show only public classes and members\n\ 5.42 +\ -protected Show protected/public classes and members (default)\n\ 5.43 +\ -package Show package/protected/public classes and members\n\ 5.44 +\ -private Show all classes and members\n\ 5.45 +\ -help Display command line options and exit\n\ 5.46 +\ -doclet <class> Generate output via alternate doclet\n\ 5.47 +\ -docletpath <path> Specify where to find doclet class files\n\ 5.48 +\ -sourcepath <pathlist> Specify where to find source files\n\ 5.49 +\ -classpath <pathlist> Specify where to find user class files\n\ 5.50 +\ -exclude <pkglist> Specify a list of packages to exclude\n\ 5.51 +\ -subpackages <subpkglist> Specify subpackages to recursively load\n\ 5.52 +\ -breakiterator Compute first sentence with BreakIterator\n\ 5.53 +\ -bootclasspath <pathlist> Override location of class files loaded\n\ 5.54 +\ by the bootstrap class loader\n\ 5.55 +\ -source <release> Provide source compatibility with specified release\n\ 5.56 +\ -extdirs <dirlist> Override location of installed extensions\n\ 5.57 +\ -verbose Output messages about what Javadoc is doing\n\ 5.58 +\ -locale <name> Locale to be used, e.g. en_US or en_US_WIN\n\ 5.59 +\ -encoding <name> Source file encoding name\n\ 5.60 +\ -quiet Do not display status messages\n\ 5.61 +\ -J<flag> Pass <flag> directly to the runtime system\n\ 5.62 +\ -X Print a synopsis of nonstandard options and exit\n 5.63 + 5.64 main.Xusage=\ 5.65 - -Xmaxerrs <number> Set the maximum number of errors to print\n\ 5.66 - -Xmaxwarns <number> Set the maximum number of warnings to print\n\ 5.67 -\n\ 5.68 +\ -Xmaxerrs <number> Set the maximum number of errors to print\n\ 5.69 +\ -Xmaxwarns <number> Set the maximum number of warnings to print\n 5.70 + 5.71 +main.Xusage.foot=\ 5.72 These options are non-standard and subject to change without notice. 5.73 + 5.74 main.option.already.seen=The {0} option may be specified no more than once. 5.75 main.requires_argument=option {0} requires an argument. 5.76 main.locale_first=option -locale must be first on the command line.
6.1 --- a/test/com/sun/javadoc/testHelpOption/TestHelpOption.java Mon Jun 03 17:09:26 2013 -0700 6.2 +++ b/test/com/sun/javadoc/testHelpOption/TestHelpOption.java Mon Jun 03 17:24:47 2013 -0700 6.3 @@ -1,5 +1,5 @@ 6.4 /* 6.5 - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. 6.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 6.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.8 * 6.9 * This code is free software; you can redistribute it and/or modify it 6.10 @@ -78,7 +78,6 @@ 6.11 {STANDARD_OUTPUT, "-tag "}, 6.12 {STANDARD_OUTPUT, "-taglet "}, 6.13 {STANDARD_OUTPUT, "-tagletpath "}, 6.14 - {STANDARD_OUTPUT, "-Xdocrootparent "}, 6.15 {STANDARD_OUTPUT, "-charset "}, 6.16 {STANDARD_OUTPUT, "-helpfile "}, 6.17 {STANDARD_OUTPUT, "-linksource "},
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/test/com/sun/javadoc/testXOption/TestXOption.java Mon Jun 03 17:24:47 2013 -0700 7.3 @@ -0,0 +1,85 @@ 7.4 +/* 7.5 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. 7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.7 + * 7.8 + * This code is free software; you can redistribute it and/or modify it 7.9 + * under the terms of the GNU General Public License version 2 only, as 7.10 + * published by the Free Software Foundation. 7.11 + * 7.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 7.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 7.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 7.15 + * version 2 for more details (a copy is included in the LICENSE file that 7.16 + * accompanied this code). 7.17 + * 7.18 + * You should have received a copy of the GNU General Public License version 7.19 + * 2 along with this work; if not, write to the Free Software Foundation, 7.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 7.21 + * 7.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 7.23 + * or visit www.oracle.com if you need additional information or have any 7.24 + * questions. 7.25 + */ 7.26 + 7.27 +/* 7.28 + * @test 7.29 + * @bug 8007687 7.30 + * @summary Make sure that the -X option works properly. 7.31 + * @library ../lib/ 7.32 + * @build JavadocTester TestXOption 7.33 + * @run main TestXOption 7.34 + */ 7.35 + 7.36 +public class TestXOption extends JavadocTester { 7.37 + 7.38 + //Test information. 7.39 + private static final String BUG_ID = "8007687"; 7.40 + 7.41 + //Javadoc arguments. 7.42 + private static final String[] ARGS = new String[] { 7.43 + "-d", BUG_ID, "-sourcepath", SRC_DIR, "-X", 7.44 + SRC_DIR + FS + "TestXOption.java" 7.45 + }; 7.46 + 7.47 + private static final String[] ARGS2 = new String[] { 7.48 + "-d", BUG_ID, "-sourcepath", SRC_DIR, 7.49 + SRC_DIR + FS + "TestXOption.java" 7.50 + }; 7.51 + 7.52 + private static final String[][] TEST = { 7.53 + {NOTICE_OUTPUT, "-Xmaxerrs "}, 7.54 + {NOTICE_OUTPUT, "-Xmaxwarns "}, 7.55 + {STANDARD_OUTPUT, "-Xdocrootparent "}, 7.56 + {STANDARD_OUTPUT, "-Xdoclint "}, 7.57 + {STANDARD_OUTPUT, "-Xdoclint:"}, 7.58 + }; 7.59 + private static final String[][] NEGATED_TEST = NO_TEST; 7.60 + 7.61 + //The help option should not crash the doclet. 7.62 + private static final int EXPECTED_EXIT_CODE = 0; 7.63 + 7.64 + /** 7.65 + * The entry point of the test. 7.66 + * @param args the array of command line arguments. 7.67 + */ 7.68 + public static void main(String[] args) { 7.69 + TestXOption tester = new TestXOption(); 7.70 + int actualExitCode = run(tester, ARGS, TEST, NEGATED_TEST); 7.71 + tester.checkExitCode(EXPECTED_EXIT_CODE, actualExitCode); 7.72 + tester.printSummary(); 7.73 + } 7.74 + 7.75 + /** 7.76 + * {@inheritDoc} 7.77 + */ 7.78 + public String getBugId() { 7.79 + return BUG_ID; 7.80 + } 7.81 + 7.82 + /** 7.83 + * {@inheritDoc} 7.84 + */ 7.85 + public String getBugName() { 7.86 + return getClass().getName(); 7.87 + } 7.88 +}