8012311: Cleanup names and duplicatre code in TagletManager

Tue, 14 May 2013 10:14:56 -0700

author
jjg
date
Tue, 14 May 2013 10:14:56 -0700
changeset 1750
081d7c72ee92
parent 1749
25c89a492f14
child 1751
ca8808c88f94

8012311: Cleanup names and duplicatre code in TagletManager
Reviewed-by: darcy

src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletWriter.java file | annotate | diff | comparison | revisions
test/com/sun/javadoc/testJavaFX/TestJavaFX.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue May 14 10:14:56 2013 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue May 14 10:14:56 2013 -0700
     1.3 @@ -248,7 +248,7 @@
     1.4          }
     1.5          TagletOutputImpl output = new TagletOutputImpl();
     1.6          TagletWriter.genTagOuput(configuration.tagletManager, doc,
     1.7 -            configuration.tagletManager.getCustomTags(doc),
     1.8 +            configuration.tagletManager.getCustomTaglets(doc),
     1.9                  getTagletWriterInstance(false), output);
    1.10          dl.addContent(output.getContent());
    1.11          htmltree.addContent(dl);
    1.12 @@ -264,7 +264,7 @@
    1.13      protected boolean hasSerializationOverviewTags(FieldDoc field) {
    1.14          TagletOutputImpl output = new TagletOutputImpl();
    1.15          TagletWriter.genTagOuput(configuration.tagletManager, field,
    1.16 -            configuration.tagletManager.getCustomTags(field),
    1.17 +            configuration.tagletManager.getCustomTaglets(field),
    1.18                  getTagletWriterInstance(false), output);
    1.19          return !output.getContent().isEmpty();
    1.20      }
     2.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java	Tue May 14 10:14:56 2013 -0700
     2.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialFieldWriter.java	Tue May 14 10:14:56 2013 -0700
     2.3 @@ -188,7 +188,7 @@
     2.4      public void addMemberTags(FieldDoc field, Content contentTree) {
     2.5          TagletOutputImpl output = new TagletOutputImpl();
     2.6          TagletWriter.genTagOuput(configuration.tagletManager, field,
     2.7 -                configuration.tagletManager.getCustomTags(field),
     2.8 +                configuration.tagletManager.getCustomTaglets(field),
     2.9                  writer.getTagletWriterInstance(false), output);
    2.10          Content tagContent = output.getContent();
    2.11          Content dlTags = new HtmlTree(HtmlTag.DL);
     3.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java	Tue May 14 10:14:56 2013 -0700
     3.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlSerialMethodWriter.java	Tue May 14 10:14:56 2013 -0700
     3.3 @@ -150,7 +150,7 @@
     3.4          TagletManager tagletManager =
     3.5              configuration.tagletManager;
     3.6          TagletWriter.genTagOuput(tagletManager, member,
     3.7 -            tagletManager.getSerializedFormTags(),
     3.8 +            tagletManager.getSerializedFormTaglets(),
     3.9              writer.getTagletWriterInstance(false), output);
    3.10          Content tagContent = output.getContent();
    3.11          Content dlTags = new HtmlTree(HtmlTag.DL);
     4.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java	Tue May 14 10:14:56 2013 -0700
     4.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletManager.java	Tue May 14 10:14:56 2013 -0700
     4.3 @@ -183,7 +183,7 @@
     4.4          this.showauthor = showauthor;
     4.5          this.javafx = javafx;
     4.6          this.message = message;
     4.7 -        initStandardTags();
     4.8 +        initStandardTaglets();
     4.9          initStandardTagsLowercase();
    4.10      }
    4.11  
    4.12 @@ -453,9 +453,9 @@
    4.13       * @return the array of <code>Taglet</code>s that can
    4.14       * appear in packages.
    4.15       */
    4.16 -    public Taglet[] getPackageCustomTags() {
    4.17 +    public Taglet[] getPackageCustomTaglets() {
    4.18          if (packageTags == null) {
    4.19 -            initCustomTagArrays();
    4.20 +            initCustomTagletArrays();
    4.21          }
    4.22          return packageTags;
    4.23      }
    4.24 @@ -466,9 +466,9 @@
    4.25       * @return the array of <code>Taglet</code>s that can
    4.26       * appear in classes or interfaces.
    4.27       */
    4.28 -    public Taglet[] getTypeCustomTags() {
    4.29 +    public Taglet[] getTypeCustomTaglets() {
    4.30          if (typeTags == null) {
    4.31 -            initCustomTagArrays();
    4.32 +            initCustomTagletArrays();
    4.33          }
    4.34          return typeTags;
    4.35      }
    4.36 @@ -479,9 +479,9 @@
    4.37       * @return the array of <code>Taglet</code>s that can
    4.38       * appear in comments.
    4.39       */
    4.40 -    public Taglet[] getInlineCustomTags() {
    4.41 +    public Taglet[] getInlineCustomTaglets() {
    4.42          if (inlineTags == null) {
    4.43 -            initCustomTagArrays();
    4.44 +            initCustomTagletArrays();
    4.45          }
    4.46          return inlineTags;
    4.47      }
    4.48 @@ -492,9 +492,9 @@
    4.49       * @return the array of <code>Taglet</code>s that can
    4.50       * appear in field.
    4.51       */
    4.52 -    public Taglet[] getFieldCustomTags() {
    4.53 +    public Taglet[] getFieldCustomTaglets() {
    4.54          if (fieldTags == null) {
    4.55 -            initCustomTagArrays();
    4.56 +            initCustomTagletArrays();
    4.57          }
    4.58          return fieldTags;
    4.59      }
    4.60 @@ -505,9 +505,9 @@
    4.61       * @return the array of <code>Taglet</code>s that can
    4.62       * appear in the serialized form.
    4.63       */
    4.64 -    public Taglet[] getSerializedFormTags() {
    4.65 +    public Taglet[] getSerializedFormTaglets() {
    4.66          if (serializedFormTags == null) {
    4.67 -            initCustomTagArrays();
    4.68 +            initCustomTagletArrays();
    4.69          }
    4.70          return serializedFormTags;
    4.71      }
    4.72 @@ -516,19 +516,19 @@
    4.73       * @return the array of <code>Taglet</code>s that can
    4.74       * appear in the given Doc.
    4.75       */
    4.76 -    public Taglet[] getCustomTags(Doc doc) {
    4.77 +    public Taglet[] getCustomTaglets(Doc doc) {
    4.78          if (doc instanceof ConstructorDoc) {
    4.79 -            return getConstructorCustomTags();
    4.80 +            return getConstructorCustomTaglets();
    4.81          } else if (doc instanceof MethodDoc) {
    4.82 -            return getMethodCustomTags();
    4.83 +            return getMethodCustomTaglets();
    4.84          } else if (doc instanceof FieldDoc) {
    4.85 -            return getFieldCustomTags();
    4.86 +            return getFieldCustomTaglets();
    4.87          } else if (doc instanceof ClassDoc) {
    4.88 -            return getTypeCustomTags();
    4.89 +            return getTypeCustomTaglets();
    4.90          } else if (doc instanceof PackageDoc) {
    4.91 -            return getPackageCustomTags();
    4.92 +            return getPackageCustomTaglets();
    4.93          } else if (doc instanceof RootDoc) {
    4.94 -            return getOverviewCustomTags();
    4.95 +            return getOverviewCustomTaglets();
    4.96          }
    4.97          return null;
    4.98      }
    4.99 @@ -539,9 +539,9 @@
   4.100       * @return the array of <code>Taglet</code>s that can
   4.101       * appear in constructors.
   4.102       */
   4.103 -    public Taglet[] getConstructorCustomTags() {
   4.104 +    public Taglet[] getConstructorCustomTaglets() {
   4.105          if (constructorTags == null) {
   4.106 -            initCustomTagArrays();
   4.107 +            initCustomTagletArrays();
   4.108          }
   4.109          return constructorTags;
   4.110      }
   4.111 @@ -552,9 +552,9 @@
   4.112       * @return the array of <code>Taglet</code>s that can
   4.113       * appear in methods.
   4.114       */
   4.115 -    public Taglet[] getMethodCustomTags() {
   4.116 +    public Taglet[] getMethodCustomTaglets() {
   4.117          if (methodTags == null) {
   4.118 -            initCustomTagArrays();
   4.119 +            initCustomTagletArrays();
   4.120          }
   4.121          return methodTags;
   4.122      }
   4.123 @@ -565,9 +565,9 @@
   4.124       * @return the array of <code>Taglet</code>s that can
   4.125       * appear in overview.
   4.126       */
   4.127 -    public Taglet[] getOverviewCustomTags() {
   4.128 +    public Taglet[] getOverviewCustomTaglets() {
   4.129          if (overviewTags == null) {
   4.130 -            initCustomTagArrays();
   4.131 +            initCustomTagletArrays();
   4.132          }
   4.133          return overviewTags;
   4.134      }
   4.135 @@ -575,7 +575,7 @@
   4.136      /**
   4.137       * Initialize the custom tag arrays.
   4.138       */
   4.139 -    private void initCustomTagArrays() {
   4.140 +    private void initCustomTagletArrays() {
   4.141          Iterator<Taglet> it = customTags.values().iterator();
   4.142          ArrayList<Taglet> pTags = new ArrayList<Taglet>(customTags.size());
   4.143          ArrayList<Taglet> tTags = new ArrayList<Taglet>(customTags.size());
   4.144 @@ -630,84 +630,72 @@
   4.145      /**
   4.146       * Initialize standard Javadoc tags for ordering purposes.
   4.147       */
   4.148 -    private void initStandardTags() {
   4.149 +    private void initStandardTaglets() {
   4.150          Taglet temp;
   4.151 -        customTags.put((temp = new ParamTaglet()).getName(), temp);
   4.152 -        customTags.put((temp = new ReturnTaglet()).getName(), temp);
   4.153 -        customTags.put((temp = new ThrowsTaglet()).getName(), temp);
   4.154 -        customTags.put((temp = new SimpleTaglet("exception",
   4.155 -            null, SimpleTaglet.METHOD + SimpleTaglet.CONSTRUCTOR)).getName(), temp);
   4.156 -        if (!nosince) {
   4.157 -            customTags.put((temp = new SimpleTaglet("since", message.getText("doclet.Since"),
   4.158 -               SimpleTaglet.ALL)).getName(), temp);
   4.159 -        }
   4.160 -        if (showversion) {
   4.161 -            customTags.put((temp = new SimpleTaglet("version", message.getText("doclet.Version"),
   4.162 -                SimpleTaglet.PACKAGE + SimpleTaglet.TYPE + SimpleTaglet.OVERVIEW)).getName(), temp);
   4.163 -        }
   4.164 -        if (showauthor) {
   4.165 -            customTags.put((temp = new SimpleTaglet("author", message.getText("doclet.Author"),
   4.166 -                SimpleTaglet.PACKAGE + SimpleTaglet.TYPE + SimpleTaglet.OVERVIEW)).getName(), temp);
   4.167 -        }
   4.168 -        customTags.put((temp = new SimpleTaglet("serialData", message.getText("doclet.SerialData"),
   4.169 -            SimpleTaglet.EXCLUDED)).getName(), temp);
   4.170 +        addStandardTaglet(new ParamTaglet());
   4.171 +        addStandardTaglet(new ReturnTaglet());
   4.172 +        addStandardTaglet(new ThrowsTaglet());
   4.173 +        addStandardTaglet(new SimpleTaglet("exception", null,
   4.174 +                SimpleTaglet.METHOD + SimpleTaglet.CONSTRUCTOR));
   4.175 +        addStandardTaglet(!nosince, new SimpleTaglet("since", message.getText("doclet.Since"),
   4.176 +               SimpleTaglet.ALL));
   4.177 +        addStandardTaglet(showversion, new SimpleTaglet("version", message.getText("doclet.Version"),
   4.178 +                SimpleTaglet.PACKAGE + SimpleTaglet.TYPE + SimpleTaglet.OVERVIEW));
   4.179 +        addStandardTaglet(showauthor, new SimpleTaglet("author", message.getText("doclet.Author"),
   4.180 +                SimpleTaglet.PACKAGE + SimpleTaglet.TYPE + SimpleTaglet.OVERVIEW));
   4.181 +        addStandardTaglet(new SimpleTaglet("serialData", message.getText("doclet.SerialData"),
   4.182 +            SimpleTaglet.EXCLUDED));
   4.183          customTags.put((temp = new SimpleTaglet("factory", message.getText("doclet.Factory"),
   4.184              SimpleTaglet.METHOD)).getName(), temp);
   4.185 -        customTags.put((temp = new SeeTaglet()).getName(), temp);
   4.186 +        addStandardTaglet(new SeeTaglet());
   4.187          //Standard inline tags
   4.188 -        customTags.put((temp = new DocRootTaglet()).getName(), temp);
   4.189 -        customTags.put((temp = new InheritDocTaglet()).getName(), temp);
   4.190 -        customTags.put((temp = new ValueTaglet()).getName(), temp);
   4.191 -        customTags.put((temp = new LiteralTaglet()).getName(), temp);
   4.192 -        customTags.put((temp = new CodeTaglet()).getName(), temp);
   4.193 +        addStandardTaglet(new DocRootTaglet());
   4.194 +        addStandardTaglet(new InheritDocTaglet());
   4.195 +        addStandardTaglet(new ValueTaglet());
   4.196 +        addStandardTaglet(new LiteralTaglet());
   4.197 +        addStandardTaglet(new CodeTaglet());
   4.198  
   4.199 -        //Keep track of the names of standard tags for error
   4.200 -        //checking purposes.
   4.201 -        standardTags.add("param");
   4.202 -        standardTags.add("return");
   4.203 -        standardTags.add("throws");
   4.204 -        standardTags.add("exception");
   4.205 -        standardTags.add("since");
   4.206 -        standardTags.add("version");
   4.207 -        standardTags.add("author");
   4.208 -        standardTags.add("see");
   4.209 +        // Keep track of the names of standard tags for error
   4.210 +        // checking purposes. The following are not handled above.
   4.211 +        // See, for example, com.sun.tools.javadoc.Comment
   4.212          standardTags.add("deprecated");
   4.213          standardTags.add("link");
   4.214          standardTags.add("linkplain");
   4.215 -        standardTags.add("inheritDoc");
   4.216 -        standardTags.add("docRoot");
   4.217 -        standardTags.add("value");
   4.218          standardTags.add("serial");
   4.219 -        standardTags.add("serialData");
   4.220          standardTags.add("serialField");
   4.221          standardTags.add("Text");
   4.222 -        standardTags.add("literal");
   4.223 -        standardTags.add("code");
   4.224  
   4.225          if (javafx) {
   4.226 -            initJavaFXTags();
   4.227 +            initJavaFXTaglets();
   4.228          }
   4.229      }
   4.230  
   4.231      /**
   4.232       * Initialize JavaFX-related tags.
   4.233       */
   4.234 -    private void initJavaFXTags() {
   4.235 -        Taglet temp;
   4.236 -        customTags.put((temp = new PropertyGetterTaglet()).getName(), temp);
   4.237 -        customTags.put((temp = new PropertySetterTaglet()).getName(), temp);
   4.238 -        customTags.put((temp = new SimpleTaglet("propertyDescription", message.getText("doclet.PropertyDescription"),
   4.239 -            SimpleTaglet.FIELD + SimpleTaglet.METHOD)).getName(), temp);
   4.240 -        customTags.put((temp = new SimpleTaglet("defaultValue", message.getText("doclet.DefaultValue"),
   4.241 -            SimpleTaglet.FIELD + SimpleTaglet.METHOD)).getName(), temp);
   4.242 -        customTags.put((temp = new SimpleTaglet("treatAsPrivate", null,
   4.243 -                SimpleTaglet.FIELD + SimpleTaglet.METHOD + SimpleTaglet.TYPE)).getName(), temp);
   4.244 +    private void initJavaFXTaglets() {
   4.245 +        addStandardTaglet(new PropertyGetterTaglet());
   4.246 +        addStandardTaglet(new PropertySetterTaglet());
   4.247 +        addStandardTaglet(new SimpleTaglet("propertyDescription",
   4.248 +                message.getText("doclet.PropertyDescription"),
   4.249 +                SimpleTaglet.FIELD + SimpleTaglet.METHOD));
   4.250 +        addStandardTaglet(new SimpleTaglet("defaultValue", message.getText("doclet.DefaultValue"),
   4.251 +            SimpleTaglet.FIELD + SimpleTaglet.METHOD));
   4.252 +        addStandardTaglet(new SimpleTaglet("treatAsPrivate", null,
   4.253 +                SimpleTaglet.FIELD + SimpleTaglet.METHOD + SimpleTaglet.TYPE));
   4.254 +    }
   4.255  
   4.256 -        standardTags.add("propertyGetter");
   4.257 -        standardTags.add("propertySetter");
   4.258 -        standardTags.add("propertyDescription");
   4.259 -        standardTags.add("defaultValue");
   4.260 -        standardTags.add("treatAsPrivate");
   4.261 +    void addStandardTaglet(Taglet taglet) {
   4.262 +        String name = taglet.getName();
   4.263 +        customTags.put(name, taglet);
   4.264 +        standardTags.add(name);
   4.265 +    }
   4.266 +
   4.267 +    void addStandardTaglet(boolean enable, Taglet taglet) {
   4.268 +        String name = taglet.getName();
   4.269 +        if (enable)
   4.270 +            customTags.put(name, taglet);
   4.271 +        standardTags.add(name);
   4.272      }
   4.273  
   4.274      /**
     5.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletWriter.java	Tue May 14 10:14:56 2013 -0700
     5.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/taglets/TagletWriter.java	Tue May 14 10:14:56 2013 -0700
     5.3 @@ -244,7 +244,7 @@
     5.4       */
     5.5      public static TagletOutput getInlineTagOuput(TagletManager tagletManager,
     5.6              Tag holderTag, Tag inlineTag, TagletWriter tagletWriter) {
     5.7 -        Taglet[] definedTags = tagletManager.getInlineCustomTags();
     5.8 +        Taglet[] definedTags = tagletManager.getInlineCustomTaglets();
     5.9          //This is a custom inline tag.
    5.10          for (int j = 0; j < definedTags.length; j++) {
    5.11              if (("@"+definedTags[j].getName()).equals(inlineTag.name())) {
     6.1 --- a/test/com/sun/javadoc/testJavaFX/TestJavaFX.java	Tue May 14 10:14:56 2013 -0700
     6.2 +++ b/test/com/sun/javadoc/testJavaFX/TestJavaFX.java	Tue May 14 10:14:56 2013 -0700
     6.3 @@ -23,7 +23,7 @@
     6.4  
     6.5  /*
     6.6   * @test
     6.7 - * @bug 7112427
     6.8 + * @bug 7112427 8012295
     6.9   * @summary Test of the JavaFX doclet features.
    6.10   * @author jvalenta
    6.11   * @library ../lib/

mercurial