8007687: javadoc -X does not include -Xdoclint

Reviewed-by: darcy
This commit is contained in:
Jonathan Gibbons 2013-06-03 17:24:47 -07:00
parent a850ba134d
commit a282ed3923
7 changed files with 206 additions and 94 deletions

View file

@ -324,8 +324,19 @@ public class ConfigurationImpl extends Configuration {
option.startsWith("-xdoclint:")) { option.startsWith("-xdoclint:")) {
return 1; return 1;
} else if (option.equals("-help")) { } else if (option.equals("-help")) {
// Uugh: first, this should not be hidden inside optionLength,
// and second, we should not be writing directly to stdout.
// But we have no access to a DocErrorReporter, which would
// allow use of reporter.printNotice
System.out.println(getText("doclet.usage")); System.out.println(getText("doclet.usage"));
return 1; return 1;
} else if (option.equals("-x")) {
// Uugh: first, this should not be hidden inside optionLength,
// and second, we should not be writing directly to stdout.
// But we have no access to a DocErrorReporter, which would
// allow use of reporter.printNotice
System.out.println(getText("doclet.X.usage"));
return 1;
} else if (option.equals("-footer") || } else if (option.equals("-footer") ||
option.equals("-header") || option.equals("-header") ||
option.equals("-packagesheader") || option.equals("-packagesheader") ||

View file

@ -186,45 +186,50 @@ doclet.Groupname_already_used=In -group option, groupname already used: {0}
doclet.Same_package_name_used=Package name format used twice: {0} doclet.Same_package_name_used=Package name format used twice: {0}
doclet.exception_encountered=Exception encountered while processing {1}\n{0} doclet.exception_encountered=Exception encountered while processing {1}\n{0}
doclet.usage=Provided by Standard doclet:\n\ doclet.usage=Provided by Standard doclet:\n\
-d <directory> Destination directory for output files\n\ \ -d <directory> Destination directory for output files\n\
-use Create class and package usage pages\n\ \ -use Create class and package usage pages\n\
-version Include @version paragraphs\n\ \ -version Include @version paragraphs\n\
-author Include @author paragraphs\n\ \ -author Include @author paragraphs\n\
-docfilessubdirs Recursively copy doc-file subdirectories\n\ \ -docfilessubdirs Recursively copy doc-file subdirectories\n\
-splitindex Split index into one file per letter\n\ \ -splitindex Split index into one file per letter\n\
-windowtitle <text> Browser window title for the documenation\n\ \ -windowtitle <text> Browser window title for the documentation\n\
-doctitle <html-code> Include title for the overview page\n\ \ -doctitle <html-code> Include title for the overview page\n\
-header <html-code> Include header text for each page\n\ \ -header <html-code> Include header text for each page\n\
-footer <html-code> Include footer text for each page\n\ \ -footer <html-code> Include footer text for each page\n\
-top <html-code> Include top text for each page\n\ \ -top <html-code> Include top text for each page\n\
-bottom <html-code> Include bottom text for each page\n\ \ -bottom <html-code> Include bottom text for each page\n\
-link <url> Create links to javadoc output at <url>\n\ \ -link <url> Create links to javadoc output at <url>\n\
-linkoffline <url> <url2> Link to docs at <url> using package list at <url2>\n\ \ -linkoffline <url> <url2> Link to docs at <url> using package list at <url2>\n\
-excludedocfilessubdir <name1>:.. Exclude any doc-files subdirectories with given name.\n\ \ -excludedocfilessubdir <name1>:.. Exclude any doc-files subdirectories with given name.\n\
-group <name> <p1>:<p2>.. Group specified packages together in overview page\n\ \ -group <name> <p1>:<p2>.. Group specified packages together in overview page\n\
-nocomment Supress description and tags, generate only declarations.\n\ \ -nocomment Suppress description and tags, generate only declarations.\n\
-nodeprecated Do not include @deprecated information\n\ \ -nodeprecated Do not include @deprecated information\n\
-noqualifier <name1>:<name2>:... Exclude the list of qualifiers from the output.\n\ \ -noqualifier <name1>:<name2>:... Exclude the list of qualifiers from the output.\n\
-nosince Do not include @since information\n\ \ -nosince Do not include @since information\n\
-notimestamp Do not include hidden time stamp\n\ \ -notimestamp Do not include hidden time stamp\n\
-nodeprecatedlist Do not generate deprecated list\n\ \ -nodeprecatedlist Do not generate deprecated list\n\
-notree Do not generate class hierarchy\n\ \ -notree Do not generate class hierarchy\n\
-noindex Do not generate index\n\ \ -noindex Do not generate index\n\
-nohelp Do not generate help link\n\ \ -nohelp Do not generate help link\n\
-nonavbar Do not generate navigation bar\n\ \ -nonavbar Do not generate navigation bar\n\
-serialwarn Generate warning about @serial tag\n\ \ -serialwarn Generate warning about @serial tag\n\
-tag <name>:<locations>:<header> Specify single argument custom tags\n\ \ -tag <name>:<locations>:<header> Specify single argument custom tags\n\
-taglet The fully qualified name of Taglet to register\n\ \ -taglet The fully qualified name of Taglet to register\n\
-tagletpath The path to Taglets\n\ \ -tagletpath The path to Taglets\n\
-Xdocrootparent <url> Replaces all appearances of @docRoot followed by /.. in doc comments with <url>\n\ \ -charset <charset> Charset for cross-platform viewing of generated documentation.\n\
-charset <charset> Charset for cross-platform viewing of generated documentation.\n\ \ -helpfile <file> Include file that help link links to\n\
-helpfile <file> Include file that help link links to\n\ \ -linksource Generate source in HTML\n\
-linksource Generate source in HTML\n\ \ -sourcetab <tab length> Specify the number of spaces each tab takes up in the source\n\
-sourcetab <tab length> Specify the number of spaces each tab takes up in the source\n\ \ -keywords Include HTML meta tags with package, class and member info\n\
-keywords Include HTML meta tags with package, class and member info\n\ \ -stylesheetfile <path> File to change style of the generated documentation\n\
-stylesheetfile <path> File to change style of the generated documentation\n\ \ -docencoding <name> Specify the character encoding for the output
-docencoding <name> Output encoding name
# L10N: do not localize these words: all none accessibility html missing reference syntax
doclet.X.usage=Provided by standard doclet:\n\
\ -Xdocrootparent <url> Replaces all appearances of @docRoot followed\n\
\ by /.. in doc comments with <url>\n\
\ -Xdoclint Enable recommended checks for problems in javadoc comments\n\
\ -Xdoclint:(all|none|[-]<group>) \n\
\ Enable or disable specific checks for problems in javadoc comments,\n\
\ where <group> is one of accessibility, html, missing, reference, or syntax.\n

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -146,11 +146,15 @@ javac.opt.Xlint.suboptlist=\
Enable or disable specific warnings Enable or disable specific warnings
javac.opt.Xdoclint=\ javac.opt.Xdoclint=\
Enable recommended checks for problems in javadoc comments Enable recommended checks for problems in javadoc comments
# L10N: do not localize: all none
javac.opt.Xdoclint.subopts = \ javac.opt.Xdoclint.subopts = \
(all|[-]<group>)[/<access>] (all|none|[-]<group>)[/<access>]
# L10N: do not localize: accessibility html missing reference syntax
# L10N: do not localize: public protected package private
javac.opt.Xdoclint.custom=\n\ javac.opt.Xdoclint.custom=\n\
\ Enable or disable specific checks for problems in javadoc comments,\n\ \ Enable or disable specific checks for problems in javadoc comments,\n\
\ where <group> is one of accessibility, html, reference, or syntax,\n\ \ where <group> is one of accessibility, html, missing, reference, or syntax,\n\
\ and <access> is one of public, protected, package, or private. \ and <access> is one of public, protected, package, or private.
javac.opt.Xstdout=\ javac.opt.Xstdout=\
Redirect standard output Redirect standard output

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -156,21 +156,8 @@ public class Start extends ToolOption.Helper {
usage(true); usage(true);
} }
void usage(boolean exit) {
/** usage("main.usage", "-help", null, exit);
* Usage
*/
private void usage(boolean exit) {
// RFE: it would be better to replace the following with code to
// write a header, then help for each option, then a footer.
messager.notice("main.usage");
// let doclet print usage information (does nothing on error)
if (docletInvoker != null) {
docletInvoker.optionLength("-help");
}
if (exit) exit();
} }
@Override @Override
@ -178,11 +165,28 @@ public class Start extends ToolOption.Helper {
Xusage(true); Xusage(true);
} }
/** void Xusage(boolean exit) {
* Usage usage("main.Xusage", "-X", "main.Xusage.foot", exit);
*/ }
private void Xusage(boolean exit) {
messager.notice("main.Xusage"); private void usage(String main, String doclet, String foot, boolean exit) {
// RFE: it would be better to replace the following with code to
// write a header, then help for each option, then a footer.
messager.notice(main);
// let doclet print usage information (does nothing on error)
if (docletInvoker != null) {
// RFE: this is a pretty bad way to get the doclet to show
// help info. Moreover, the output appears on stdout,
// and <i>not</i> on any of the standard streams passed
// to javadoc, and in particular, not to the noticeWriter
// But, to fix this, we need to fix the Doclet API.
docletInvoker.optionLength(doclet);
}
if (foot != null)
messager.notice(foot);
if (exit) exit(); if (exit) exit();
} }

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved. # Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
# #
# This code is free software; you can redistribute it and/or modify it # This code is free software; you can redistribute it and/or modify it
@ -27,35 +27,39 @@ main.errors={0} errors
main.error={0} error main.error={0} error
main.warnings={0} warnings main.warnings={0} warnings
main.warning={0} warning main.warning={0} warning
main.usage=usage: javadoc [options] [packagenames] [sourcefiles] [@files]\n\
-overview <file> Read overview documentation from HTML file\n\ main.usage=Usage: javadoc [options] [packagenames] [sourcefiles] [@files]\n\
-public Show only public classes and members\n\ \ -overview <file> Read overview documentation from HTML file\n\
-protected Show protected/public classes and members (default)\n\ \ -public Show only public classes and members\n\
-package Show package/protected/public classes and members\n\ \ -protected Show protected/public classes and members (default)\n\
-private Show all classes and members\n\ \ -package Show package/protected/public classes and members\n\
-help Display command line options and exit\n\ \ -private Show all classes and members\n\
-doclet <class> Generate output via alternate doclet\n\ \ -help Display command line options and exit\n\
-docletpath <path> Specify where to find doclet class files\n\ \ -doclet <class> Generate output via alternate doclet\n\
-sourcepath <pathlist> Specify where to find source files\n\ \ -docletpath <path> Specify where to find doclet class files\n\
-classpath <pathlist> Specify where to find user class files\n\ \ -sourcepath <pathlist> Specify where to find source files\n\
-exclude <pkglist> Specify a list of packages to exclude\n\ \ -classpath <pathlist> Specify where to find user class files\n\
-subpackages <subpkglist> Specify subpackages to recursively load\n\ \ -exclude <pkglist> Specify a list of packages to exclude\n\
-breakiterator Compute 1st sentence with BreakIterator\n\ \ -subpackages <subpkglist> Specify subpackages to recursively load\n\
-bootclasspath <pathlist> Override location of class files loaded\n\ \ -breakiterator Compute first sentence with BreakIterator\n\
\t\t\t by the bootstrap class loader\n\ \ -bootclasspath <pathlist> Override location of class files loaded\n\
-source <release> Provide source compatibility with specified release\n\ \ by the bootstrap class loader\n\
-extdirs <dirlist> Override location of installed extensions\n\ \ -source <release> Provide source compatibility with specified release\n\
-verbose Output messages about what Javadoc is doing\n\ \ -extdirs <dirlist> Override location of installed extensions\n\
-locale <name> Locale to be used, e.g. en_US or en_US_WIN\n\ \ -verbose Output messages about what Javadoc is doing\n\
-encoding <name> Source file encoding name\n\ \ -locale <name> Locale to be used, e.g. en_US or en_US_WIN\n\
-quiet Do not display status messages\n\ \ -encoding <name> Source file encoding name\n\
-J<flag> Pass <flag> directly to the runtime system\n\ \ -quiet Do not display status messages\n\
-X Print a synopsis of nonstandard options\n \ -J<flag> Pass <flag> directly to the runtime system\n\
\ -X Print a synopsis of nonstandard options and exit\n
main.Xusage=\ main.Xusage=\
-Xmaxerrs <number> Set the maximum number of errors to print\n\ \ -Xmaxerrs <number> Set the maximum number of errors to print\n\
-Xmaxwarns <number> Set the maximum number of warnings to print\n\ \ -Xmaxwarns <number> Set the maximum number of warnings to print\n
\n\
main.Xusage.foot=\
These options are non-standard and subject to change without notice. These options are non-standard and subject to change without notice.
main.option.already.seen=The {0} option may be specified no more than once. main.option.already.seen=The {0} option may be specified no more than once.
main.requires_argument=option {0} requires an argument. main.requires_argument=option {0} requires an argument.
main.locale_first=option -locale must be first on the command line. main.locale_first=option -locale must be first on the command line.

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -78,7 +78,6 @@ public class TestHelpOption extends JavadocTester {
{STANDARD_OUTPUT, "-tag "}, {STANDARD_OUTPUT, "-tag "},
{STANDARD_OUTPUT, "-taglet "}, {STANDARD_OUTPUT, "-taglet "},
{STANDARD_OUTPUT, "-tagletpath "}, {STANDARD_OUTPUT, "-tagletpath "},
{STANDARD_OUTPUT, "-Xdocrootparent "},
{STANDARD_OUTPUT, "-charset "}, {STANDARD_OUTPUT, "-charset "},
{STANDARD_OUTPUT, "-helpfile "}, {STANDARD_OUTPUT, "-helpfile "},
{STANDARD_OUTPUT, "-linksource "}, {STANDARD_OUTPUT, "-linksource "},

View file

@ -0,0 +1,85 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 8007687
* @summary Make sure that the -X option works properly.
* @library ../lib/
* @build JavadocTester TestXOption
* @run main TestXOption
*/
public class TestXOption extends JavadocTester {
//Test information.
private static final String BUG_ID = "8007687";
//Javadoc arguments.
private static final String[] ARGS = new String[] {
"-d", BUG_ID, "-sourcepath", SRC_DIR, "-X",
SRC_DIR + FS + "TestXOption.java"
};
private static final String[] ARGS2 = new String[] {
"-d", BUG_ID, "-sourcepath", SRC_DIR,
SRC_DIR + FS + "TestXOption.java"
};
private static final String[][] TEST = {
{NOTICE_OUTPUT, "-Xmaxerrs "},
{NOTICE_OUTPUT, "-Xmaxwarns "},
{STANDARD_OUTPUT, "-Xdocrootparent "},
{STANDARD_OUTPUT, "-Xdoclint "},
{STANDARD_OUTPUT, "-Xdoclint:"},
};
private static final String[][] NEGATED_TEST = NO_TEST;
//The help option should not crash the doclet.
private static final int EXPECTED_EXIT_CODE = 0;
/**
* The entry point of the test.
* @param args the array of command line arguments.
*/
public static void main(String[] args) {
TestXOption tester = new TestXOption();
int actualExitCode = run(tester, ARGS, TEST, NEGATED_TEST);
tester.checkExitCode(EXPECTED_EXIT_CODE, actualExitCode);
tester.printSummary();
}
/**
* {@inheritDoc}
*/
public String getBugId() {
return BUG_ID;
}
/**
* {@inheritDoc}
*/
public String getBugName() {
return getClass().getName();
}
}