changeset 39181:e2526131d705

8160135: The Html doclet handles options incorrectly Reviewed-by: jjg
author ksrini
date Fri, 24 Jun 2016 16:00:43 -0700
parents bed7937d5ac4
children d4487b864f64
files langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConfigurationImpl.java langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java
diffstat 3 files changed, 92 insertions(+), 78 deletions(-) [+]
line wrap: on
line diff
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConfigurationImpl.java	Thu Jun 23 21:13:09 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/ConfigurationImpl.java	Fri Jun 24 16:00:43 2016 -0700
@@ -547,7 +547,7 @@
     @Override
     public Set<Doclet.Option> getSupportedOptions() {
         Doclet.Option[] options = {
-            new Option(this, "bottom", 1) {
+            new Option(this, "-bottom", 1) {
                 @Override
                 public boolean process(String opt,  ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -555,7 +555,7 @@
                     return true;
                 }
             },
-            new Option(this, "charset", 1) {
+            new Option(this, "-charset", 1) {
                 @Override
                 public boolean process(String opt,  ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -563,7 +563,7 @@
                     return true;
                 }
             },
-            new Option(this, "doctitle", 1) {
+            new Option(this, "-doctitle", 1) {
                 @Override
                 public boolean process(String opt,  ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -571,7 +571,7 @@
                     return true;
                 }
             },
-            new Option(this, "footer", 1) {
+            new Option(this, "-footer", 1) {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -579,7 +579,7 @@
                     return true;
                 }
             },
-            new Option(this, "header", 1) {
+            new Option(this, "-header", 1) {
                 @Override
                 public boolean process(String opt,  ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -587,7 +587,7 @@
                     return true;
                 }
             },
-            new Option(this, "helpfile", 1) {
+            new Option(this, "-helpfile", 1) {
                 @Override
                 public boolean process(String opt,  ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -595,7 +595,7 @@
                     return true;
                 }
             },
-            new Option(this, "html4") {
+            new Option(this, "-html4") {
                 @Override
                 public boolean process(String opt,  ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -603,7 +603,7 @@
                     return true;
                 }
             },
-            new Option(this, "html5") {
+            new Option(this, "-html5") {
                 @Override
                 public boolean process(String opt,  ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -611,7 +611,7 @@
                     return true;
                 }
             },
-            new Option(this, "nohelp") {
+            new Option(this, "-nohelp") {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -619,7 +619,7 @@
                     return true;
                 }
             },
-            new Option(this, "nodeprecatedlist") {
+            new Option(this, "-nodeprecatedlist") {
                 @Override
                 public boolean process(String opt,  ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -627,7 +627,7 @@
                     return true;
                 }
             },
-            new Option(this, "noindex") {
+            new Option(this, "-noindex") {
                 @Override
                 public boolean process(String opt,  ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -635,7 +635,7 @@
                     return true;
                 }
             },
-            new Option(this, "nonavbar") {
+            new Option(this, "-nonavbar") {
                 @Override
                 public boolean process(String opt,  ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -643,7 +643,7 @@
                     return true;
                 }
             },
-            new Hidden(this, "nooverview") {
+            new Hidden(this, "-nooverview") {
                 @Override
                 public boolean process(String opt,  ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -651,7 +651,7 @@
                     return true;
                 }
             },
-            new Option(this, "notree") {
+            new Option(this, "-notree") {
                 @Override
                 public boolean process(String opt,  ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -659,7 +659,7 @@
                     return true;
                 }
             },
-            new Hidden(this, "overview", 1) {
+            new Hidden(this, "-overview", 1) {
                 @Override
                 public boolean process(String opt,  ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -667,7 +667,7 @@
                     return true;
                 }
             },
-            new Hidden(this, "packagesheader", 1) {
+            new Hidden(this, "-packagesheader", 1) {
                 @Override
                 public boolean process(String opt,  ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -675,7 +675,7 @@
                     return true;
                 }
             },
-            new Option(this, "splitindex") {
+            new Option(this, "-splitindex") {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -683,7 +683,7 @@
                     return true;
                 }
             },
-            new Option(this, "stylesheetfile", 1) {
+            new Option(this, "-stylesheetfile", 1) {
                 @Override
                 public boolean process(String opt,  ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -691,7 +691,7 @@
                     return true;
                 }
             },
-            new Option(this, "top", 1) {
+            new Option(this, "-top", 1) {
                 @Override
                 public boolean process(String opt,  ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -699,7 +699,7 @@
                     return true;
                 }
             },
-            new Option(this, "use") {
+            new Option(this, "-use") {
                 @Override
                 public boolean process(String opt,  ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -707,7 +707,7 @@
                     return true;
                 }
             },
-            new Option(this, "windowtitle", 1) {
+            new Option(this, "-windowtitle", 1) {
                 @Override
                 public boolean process(String opt,  ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -715,7 +715,7 @@
                     return true;
                 }
             },
-            new XOption(this, "xdoclint") {
+            new XOption(this, "-Xdoclint") {
                 @Override
                 public boolean process(String opt,  ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -723,7 +723,7 @@
                     return true;
                 }
             },
-            new XOption(this, "Xdocrootparent", 1) {
+            new XOption(this, "-Xdocrootparent", 1) {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -731,11 +731,10 @@
                     return true;
                 }
             },
-            new XOption(this, "doclet.xusage.xdoclint-extended.", "Xdoclint:", 0) {
+            new XOption(this, "doclet.xusage.xdoclint-extended.", "-Xdoclint:", 0) {
                 @Override
                 public boolean matches(String option) {
-                    String opt = option.startsWith("-") ? option.substring(1) : option;
-                    return opt.toLowerCase().startsWith(getName().toLowerCase());
+                    return option.toLowerCase().startsWith(getName().toLowerCase());
                 }
 
                 @Override
@@ -745,11 +744,10 @@
                     return true;
                 }
             },
-            new XOption(this, "doclet.xusage.xdoclint-package.", "Xdoclint/package:", 0) {
+            new XOption(this, "doclet.xusage.xdoclint-package.", "-Xdoclint/package:", 0) {
                 @Override
                 public boolean matches(String option) {
-                    String opt = option.startsWith("-") ? option.substring(1) : option;
-                    return opt.toLowerCase().startsWith(getName().toLowerCase());
+                    return option.toLowerCase().startsWith(getName().toLowerCase());
                 }
 
                 @Override
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties	Thu Jun 23 21:13:09 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/formats/html/resources/standard.properties	Fri Jun 24 16:00:43 2016 -0700
@@ -185,6 +185,7 @@
 doclet.Same_package_name_used=Package name format used twice: {0}
 doclet.exception_encountered=Exception encountered while processing {1}\n{0}
 
+# option specifiers
 doclet.usage.d.name=d
 doclet.usage.d.parameters=<directory>
 doclet.usage.d.description=Destination directory for output files
@@ -240,18 +241,23 @@
 
 doclet.usage.linkoffline.name=linkoffline
 doclet.usage.linkoffline.parameters=<url1> <url2>
-doclet.usage.linkoffline.description=Link to docs at <url1> using package list at <url2>
+doclet.usage.linkoffline.description=Link to docs at <url1> using package list\n\
+\                                  at <url2>
 
 doclet.usage.excludedocfilessubdir.name=excludedocfilessubdir
 doclet.usage.excludedocfilessubdir.parameters=<name>:..
-doclet.usage.excludedocfilessubdir.description=Exclude any doc-files subdirectories with given name
+doclet.usage.excludedocfilessubdir.description=\n\
+\                                  Exclude any doc-files subdirectories with\n\
+\                                  given name
 
 doclet.usage.group.name=group
 doclet.usage.group.parameters=<name> <p1>:<p2>..
-doclet.usage.group.description=Group specified packages together in overview page
+doclet.usage.group.description=Group specified packages together\n\
+\                                  in overview page
 
 doclet.usage.nocomment.name=nocomment
-doclet.usage.nocomment.description=Suppress description and tags, generate only declarations
+doclet.usage.nocomment.description=Suppress description and tags, generate\n\
+\                                  only declarations
 
 doclet.usage.nodeprecated.name=nodeprecated
 doclet.usage.nodeprecated.description=Do not include @deprecated information
@@ -289,7 +295,8 @@
 
 doclet.usage.tag.name=tag
 doclet.usage.tag.parameters=<name>:<locations>:<header>
-doclet.usage.tag.description=Specify single argument custom tags
+doclet.usage.tag.description=\n\
+\                                  Specify single argument custom tags
 
 doclet.usage.taglet.name=taglet
 doclet.usage.taglet.description=The fully qualified name of Taglet to register
@@ -299,7 +306,8 @@
 
 doclet.usage.charset.name=charset
 doclet.usage.charset.parameters=<charset>
-doclet.usage.charset.description=Charset for cross-platform viewing of generated documentation
+doclet.usage.charset.description=Charset for cross-platform viewing of\n\
+\                                  generated documentation
 
 doclet.usage.helpfile.name=helpfile
 doclet.usage.helpfile.parameters=<file>
@@ -310,14 +318,17 @@
 
 doclet.usage.sourcetab.name=sourcetab
 doclet.usage.sourcetab.parameters=<tab length>
-doclet.usage.sourcetab.description=Specify the number of spaces each tab takes up in the source
+doclet.usage.sourcetab.description=Specify the number of spaces each tab\n\
+\                                  takes up in the source
 
 doclet.usage.keywords.name=keywords
-doclet.usage.keywords.description=Include HTML meta tags with package, class and member info
+doclet.usage.keywords.description=Include HTML meta tags with package,\n\
+\                                  class and member info
 
 doclet.usage.stylesheetfile.name=stylesheetfile
 doclet.usage.stylesheetfile.parameters=<path>
-doclet.usage.stylesheetfile.description=File to change style of the generated documentation
+doclet.usage.stylesheetfile.description=File to change style of the generated\n\
+\                                  documentation
 
 doclet.usage.docencoding.name=docencoding
 doclet.usage.docencoding.parameters=<name>
@@ -325,23 +336,30 @@
 
 doclet.xusage.xdocrootparent.name=Xdocrootparent
 doclet.xusage.xdocrootparent.parameters=<url>
-doclet.xusage.xdocrootparent.description=Replaces all @docRoot followed by /.. in doc comments with <url>
+doclet.xusage.xdocrootparent.description=Replaces all @docRoot followed by /..\n\
+\                                  in doc comments with <url>
 
 doclet.xusage.xdoclint.name=Xdoclint
-doclet.xusage.xdoclint.description=Enable recommended checks for problems in javadoc comments
+doclet.xusage.xdoclint.description=Enable recommended checks for problems in\n\
+\                                  javadoc comments
 
 doclet.xusage.xdoclint-extended.name=Xdoclint:
 doclet.xusage.xdoclint-extended.parameters=(all|none|[-]<group>)
 # L10N: do not localize these words: all none accessibility html missing reference syntax
-doclet.xusage.xdoclint-extended.description=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, missing, reference, or syntax.\n
+doclet.xusage.xdoclint-extended.description=Enable or disable specific checks\n\
+\                                  for problems in javadoc comments, where \n\
+\                                  <group> is one of accessibility, html,\n\
+\                                  missing, reference, or syntax.\n
 
 doclet.xusage.xdoclint-package.name=Xdoclint/package:
 doclet.xusage.xdoclint-package.parameters=([-]<packages>)
 doclet.xusage.xdoclint-package.description=\n\
-\        Enable or disable checks in specific packages. <packages> is a comma separated\n\
-\        list of package specifiers. Package specifier is either a qualified name of a package\n\
-\        or a package name prefix followed by .*, which expands to all sub-packages of\n\
-\        the given package. Prefix the package specifier with - to disable checks for\n\
-\        the specified packages.\n
+\                                  Enable or disable checks in specific\n\
+\                                  packages. <packages> is a comma separated\n\
+\                                  list of package specifiers. Package\n\
+\                                  specifier is either a qualified name of a\n\
+\                                  package or a package name prefix followed\n\
+\                                  by .*, which expands to all sub-packages\n\
+\                                  of the given package. Prefix the package\n\
+\                                  specifier with - to disable checks for\n\
+\                                  the specified packages.\n
--- a/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java	Thu Jun 23 21:13:09 2016 +0000
+++ b/langtools/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/Configuration.java	Fri Jun 24 16:00:43 2016 -0700
@@ -411,7 +411,7 @@
 
     public Set<Doclet.Option> getSupportedOptions() {
         Doclet.Option[] options = {
-            new Option(this, "author") {
+            new Option(this, "-author") {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -419,7 +419,7 @@
                     return true;
                 }
             },
-            new Option(this, "d", 1) {
+            new Option(this, "-d", 1) {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -427,7 +427,7 @@
                     return true;
                 }
             },
-            new Option(this, "docencoding", 1) {
+            new Option(this, "-docencoding", 1) {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -435,7 +435,7 @@
                     return true;
                 }
             },
-            new Option(this, "docfilessubdirs") {
+            new Option(this, "-docfilessubdirs") {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -443,7 +443,7 @@
                     return true;
                 }
             },
-            new Hidden(this, "encoding", 1) {
+            new Hidden(this, "-encoding", 1) {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -451,7 +451,7 @@
                     return true;
                 }
             },
-            new Option(this, "excludedocfilessubdir", 1) {
+            new Option(this, "-excludedocfilessubdir", 1) {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -459,7 +459,7 @@
                     return true;
                 }
             },
-            new Option(this, "group", 2) {
+            new Option(this, "-group", 2) {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -467,7 +467,7 @@
                     return true;
                 }
             },
-            new Hidden(this, "javafx") {
+            new Hidden(this, "-javafx") {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -475,7 +475,7 @@
                     return true;
                 }
             },
-            new Option(this, "keywords") {
+            new Option(this, "-keywords") {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -483,7 +483,7 @@
                     return true;
                 }
             },
-            new Option(this, "link", 1) {
+            new Option(this, "-link", 1) {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -492,7 +492,7 @@
                     return true;
                 }
             },
-            new Option(this, "linksource") {
+            new Option(this, "-linksource") {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -500,7 +500,7 @@
                     return true;
                 }
             },
-            new Option(this, "linkoffline", 2) {
+            new Option(this, "-linkoffline", 2) {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -509,7 +509,7 @@
                     return true;
                 }
             },
-            new Option(this, "nocomment") {
+            new Option(this, "-nocomment") {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -517,7 +517,7 @@
                     return true;
                 }
             },
-            new Option(this, "nodeprecated") {
+            new Option(this, "-nodeprecated") {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -525,7 +525,7 @@
                     return true;
                 }
             },
-            new Option(this, "nosince") {
+            new Option(this, "-nosince") {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -533,7 +533,7 @@
                     return true;
                 }
             },
-            new Option(this, "notimestamp") {
+            new Option(this, "-notimestamp") {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -541,7 +541,7 @@
                     return true;
                 }
             },
-            new Option(this, "noqualifier", 1) {
+            new Option(this, "-noqualifier", 1) {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -549,7 +549,7 @@
                     return true;
                 }
             },
-            new Hidden(this, "quiet") {
+            new Hidden(this, "-quiet") {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -557,7 +557,7 @@
                     return true;
                 }
             },
-            new Option(this, "serialwarn") {
+            new Option(this, "-serialwarn") {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -565,7 +565,7 @@
                     return true;
                 }
             },
-            new Option(this, "sourcetab", 1) {
+            new Option(this, "-sourcetab", 1) {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -584,7 +584,7 @@
                     return true;
                 }
             },
-            new Option(this, "tag", 1) {
+            new Option(this, "-tag", 1) {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -595,7 +595,7 @@
                     return true;
                 }
             },
-             new Option(this, "taglet", 1) {
+             new Option(this, "-taglet", 1) {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -606,7 +606,7 @@
                     return true;
                 }
             },
-            new Option(this, "tagletpath", 1) {
+            new Option(this, "-tagletpath", 1) {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -614,7 +614,7 @@
                     return true;
                 }
             },
-            new Option(this, "version") {
+            new Option(this, "-version") {
                 @Override
                 public boolean process(String opt, ListIterator<String> args) {
                     optionsProcessed.add(this);
@@ -1083,14 +1083,13 @@
 
         protected Option(Configuration config, String keyName, String name, int argCount) {
             c = config;
+            this.name = name;
             String key = keyName + "name";
             String oname = getOptionsMessage(key);
             if (oname.isEmpty()) {
-                this.name = name;
                 this.parameters = "<MISSING KEY>";
                 this.description = "<MISSING KEY>";
             } else {
-                this.name = oname;
                 this.parameters = getOptionsMessage(keyName + "parameters");
                 this.description = getOptionsMessage(keyName + "description");
             }
@@ -1098,7 +1097,7 @@
         }
 
         protected Option(String prefix, Configuration config, String name, int argCount) {
-            this(config, prefix + name.toLowerCase() + ".", name, argCount);
+            this(config, prefix + name.toLowerCase().replaceAll("^-*", "") + ".", name, argCount);
         }
 
         protected Option(Configuration config, String name, int argCount) {
@@ -1146,7 +1145,7 @@
             String opt = name + (name.endsWith(":") ? "" : " ") + parameters;
             int optlen = opt.length();
             int spaces = 32 - optlen;
-            StringBuffer sb = new StringBuffer("  -").append(opt);
+            StringBuffer sb = new StringBuffer("  ").append(opt);
             for (int i = 0; i < spaces; i++) {
                 sb.append(" ");
             }
@@ -1161,8 +1160,7 @@
 
         @Override
         public boolean matches(String option) {
-            String arg = option.startsWith("-") ? option.substring(1) : option;
-            return name.toLowerCase().equals(arg.toLowerCase());
+            return name.toLowerCase().equals(option.toLowerCase());
         }
 
         @Override