8011288: Erratic/inconsistent indentation of signatures

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

author
jjg
date
Tue, 14 May 2013 10:14:53 -0700
changeset 1741
4c43e51433ba
parent 1740
ce4f0769b4b2
child 1742
7af0fa419a2b

8011288: Erratic/inconsistent indentation of signatures
Reviewed-by: darcy

src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java file | annotate | diff | comparison | revisions
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/LinkFactoryImpl.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/formats/html/markup/RawHtml.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/formats/html/markup/StringContent.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkFactory.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkInfo.java file | annotate | diff | comparison | revisions
test/com/sun/javadoc/testIndentation/TestIndentation.java file | annotate | diff | comparison | revisions
test/com/sun/javadoc/testIndentation/p/Indent.java file | annotate | diff | comparison | revisions
test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java file | annotate | diff | comparison | revisions
test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java file | annotate | diff | comparison | revisions
test/com/sun/javadoc/testTypeParams/TestTypeParameters.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java	Tue May 14 10:14:53 2013 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractExecutableMemberWriter.java	Tue May 14 10:14:53 2013 -0700
     1.3 @@ -60,17 +60,24 @@
     1.4       * @param htmltree the content tree to which the parameters will be added.
     1.5       * @return the display length required to write this information.
     1.6       */
     1.7 -    protected int addTypeParameters(ExecutableMemberDoc member, Content htmltree) {
     1.8 +    protected void addTypeParameters(ExecutableMemberDoc member, Content htmltree) {
     1.9 +        Content typeParameters = getTypeParameters(member);
    1.10 +        if (!typeParameters.isEmpty()) {
    1.11 +            htmltree.addContent(typeParameters);
    1.12 +            htmltree.addContent(writer.getSpace());
    1.13 +        }
    1.14 +    }
    1.15 +
    1.16 +    /**
    1.17 +     * Get the type parameters for the executable member.
    1.18 +     *
    1.19 +     * @param member the member for which to get the type parameters.
    1.20 +     * @return the type parameters.
    1.21 +     */
    1.22 +    protected Content getTypeParameters(ExecutableMemberDoc member) {
    1.23          LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
    1.24              LinkInfoImpl.Kind.MEMBER_TYPE_PARAMS, member);
    1.25 -        Content typeParameters = writer.getTypeParameterLinks(linkInfo);
    1.26 -        if (linkInfo.displayLength > 0) {
    1.27 -            Content linkContent = typeParameters;
    1.28 -            htmltree.addContent(linkContent);
    1.29 -            htmltree.addContent(writer.getSpace());
    1.30 -            writer.displayLength += linkInfo.displayLength + 1;
    1.31 -        }
    1.32 -        return linkInfo.displayLength;
    1.33 +        return writer.getTypeParameterLinks(linkInfo);
    1.34      }
    1.35  
    1.36      /**
    1.37 @@ -98,8 +105,7 @@
    1.38                  writer.getDocLink(context, cd, (MemberDoc) emd,
    1.39                  name, false));
    1.40          Content code = HtmlTree.CODE(strong);
    1.41 -        writer.displayLength = name.length();
    1.42 -        addParameters(emd, false, code);
    1.43 +        addParameters(emd, false, code, name.length() - 1);
    1.44          tdSummary.addContent(code);
    1.45      }
    1.46  
    1.47 @@ -166,8 +172,8 @@
    1.48       * @param member the member to write parameters for.
    1.49       * @param htmltree the content tree to which the parameters information will be added.
    1.50       */
    1.51 -    protected void addParameters(ExecutableMemberDoc member, Content htmltree) {
    1.52 -        addParameters(member, true, htmltree);
    1.53 +    protected void addParameters(ExecutableMemberDoc member, Content htmltree, int indentSize) {
    1.54 +        addParameters(member, true, htmltree, indentSize);
    1.55      }
    1.56  
    1.57      /**
    1.58 @@ -178,15 +184,11 @@
    1.59       * @param htmltree the content tree to which the parameters information will be added.
    1.60       */
    1.61      protected void addParameters(ExecutableMemberDoc member,
    1.62 -            boolean includeAnnotations, Content htmltree) {
    1.63 +            boolean includeAnnotations, Content htmltree, int indentSize) {
    1.64          htmltree.addContent("(");
    1.65          String sep = "";
    1.66          Parameter[] params = member.parameters();
    1.67 -        String indent = makeSpace(writer.displayLength);
    1.68 -        if (configuration.linksource) {
    1.69 -            //add spaces to offset indentation changes caused by link.
    1.70 -            indent+= makeSpace(member.name().length());
    1.71 -        }
    1.72 +        String indent = makeSpace(indentSize + 1);
    1.73          Type rcvrType = member.receiverType();
    1.74          if (includeAnnotations && rcvrType instanceof AnnotatedType) {
    1.75              AnnotationDesc[] descList = rcvrType.asAnnotatedType().annotations();
    1.76 @@ -240,21 +242,16 @@
    1.77       * @param member the member to write exceptions for.
    1.78       * @param htmltree the content tree to which the exceptions information will be added.
    1.79       */
    1.80 -    protected void addExceptions(ExecutableMemberDoc member, Content htmltree) {
    1.81 +    protected void addExceptions(ExecutableMemberDoc member, Content htmltree, int indentSize) {
    1.82          Type[] exceptions = member.thrownExceptionTypes();
    1.83 -        if(exceptions.length > 0) {
    1.84 +        if (exceptions.length > 0) {
    1.85              LinkInfoImpl memberTypeParam = new LinkInfoImpl(configuration,
    1.86                      LinkInfoImpl.Kind.MEMBER, member);
    1.87 -            int retlen = getReturnTypeLength(member);
    1.88 -            writer.getTypeParameterLinks(memberTypeParam);
    1.89 -            retlen += memberTypeParam.displayLength == 0 ?
    1.90 -                0 : memberTypeParam.displayLength + 1;
    1.91 -            String indent = makeSpace(modifierString(member).length() +
    1.92 -                    member.name().length() + retlen - 4);
    1.93 +            String indent = makeSpace(indentSize + 1 - 7);
    1.94              htmltree.addContent(DocletConstants.NL);
    1.95              htmltree.addContent(indent);
    1.96              htmltree.addContent("throws ");
    1.97 -            indent += "       ";
    1.98 +            indent = makeSpace(indentSize + 1);
    1.99              Content link = writer.getLink(new LinkInfoImpl(configuration,
   1.100                      LinkInfoImpl.Kind.MEMBER, exceptions[0]));
   1.101              htmltree.addContent(link);
   1.102 @@ -269,24 +266,6 @@
   1.103          }
   1.104      }
   1.105  
   1.106 -    protected int getReturnTypeLength(ExecutableMemberDoc member) {
   1.107 -        if (member instanceof MethodDoc) {
   1.108 -            MethodDoc method = (MethodDoc)member;
   1.109 -            Type rettype = method.returnType();
   1.110 -            if (rettype.isPrimitive()) {
   1.111 -                return rettype.typeName().length() +
   1.112 -                       rettype.dimension().length();
   1.113 -            } else {
   1.114 -                LinkInfoImpl linkInfo = new LinkInfoImpl(configuration,
   1.115 -                    LinkInfoImpl.Kind.MEMBER, rettype);
   1.116 -                writer.getLink(linkInfo);
   1.117 -                return linkInfo.displayLength;
   1.118 -            }
   1.119 -        } else {   // it's a constructordoc
   1.120 -            return -1;
   1.121 -        }
   1.122 -    }
   1.123 -
   1.124      protected ClassDoc implementsMethodInIntfac(MethodDoc method,
   1.125                                                  ClassDoc[] intfacs) {
   1.126          for (int i = 0; i < intfacs.length; i++) {
     2.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java	Tue May 14 10:14:53 2013 -0700
     2.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/AbstractMemberWriter.java	Tue May 14 10:14:53 2013 -0700
     2.3 @@ -193,14 +193,13 @@
     2.4      protected abstract void addNavDetailLink(boolean link, Content liNav);
     2.5  
     2.6      /**
     2.7 -     * Add the member name to the content tree and modifies the display length.
     2.8 +     * Add the member name to the content tree.
     2.9       *
    2.10       * @param name the member name to be added to the content tree.
    2.11       * @param htmltree the content tree to which the name will be added.
    2.12       */
    2.13      protected void addName(String name, Content htmltree) {
    2.14          htmltree.addContent(name);
    2.15 -        writer.displayLength += name.length();
    2.16      }
    2.17  
    2.18      /**
    2.19 @@ -259,7 +258,7 @@
    2.20              return "";
    2.21          }
    2.22          StringBuilder sb = new StringBuilder(len);
    2.23 -        for(int i = 0; i < len; i++) {
    2.24 +        for (int i = 0; i < len; i++) {
    2.25              sb.append(' ');
    2.26      }
    2.27          return sb.toString();
    2.28 @@ -286,11 +285,14 @@
    2.29          } else {
    2.30              if (member instanceof ExecutableMemberDoc &&
    2.31                      ((ExecutableMemberDoc) member).typeParameters().length > 0) {
    2.32 +                Content typeParameters = ((AbstractExecutableMemberWriter) this).getTypeParameters(
    2.33 +                        (ExecutableMemberDoc) member);
    2.34 +                    code.addContent(typeParameters);
    2.35                  //Code to avoid ugly wrapping in member summary table.
    2.36 -                int displayLength = ((AbstractExecutableMemberWriter) this).addTypeParameters(
    2.37 -                        (ExecutableMemberDoc) member, code);
    2.38 -                if (displayLength > 10) {
    2.39 +                if (typeParameters.charCount() > 10) {
    2.40                      code.addContent(new HtmlTree(HtmlTag.BR));
    2.41 +                } else {
    2.42 +                    code.addContent(writer.getSpace());
    2.43                  }
    2.44                  code.addContent(
    2.45                          writer.getLink(new LinkInfoImpl(configuration,
     3.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java	Tue May 14 10:14:53 2013 -0700
     3.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/ConstructorWriterImpl.java	Tue May 14 10:14:53 2013 -0700
     3.3 @@ -126,7 +126,6 @@
     3.4       * {@inheritDoc}
     3.5       */
     3.6      public Content getSignature(ConstructorDoc constructor) {
     3.7 -        writer.displayLength = 0;
     3.8          Content pre = new HtmlTree(HtmlTag.PRE);
     3.9          writer.addAnnotationInfo(constructor, pre);
    3.10          addModifiers(constructor, pre);
    3.11 @@ -136,8 +135,9 @@
    3.12          } else {
    3.13              addName(constructor.name(), pre);
    3.14          }
    3.15 -        addParameters(constructor, pre);
    3.16 -        addExceptions(constructor, pre);
    3.17 +        int indent = pre.charCount();
    3.18 +        addParameters(constructor, pre, indent);
    3.19 +        addExceptions(constructor, pre, indent);
    3.20          return pre;
    3.21      }
    3.22  
     4.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue May 14 10:14:53 2013 -0700
     4.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue May 14 10:14:53 2013 -0700
     4.3 @@ -75,11 +75,6 @@
     4.4      public final DocPath filename;
     4.5  
     4.6      /**
     4.7 -     * The display length used for indentation while generating the class page.
     4.8 -     */
     4.9 -    public int displayLength = 0;
    4.10 -
    4.11 -    /**
    4.12       * The global configuration information for this run.
    4.13       */
    4.14      public final ConfigurationImpl configuration;
    4.15 @@ -1121,9 +1116,7 @@
    4.16       */
    4.17      public Content getLink(LinkInfoImpl linkInfo) {
    4.18          LinkFactoryImpl factory = new LinkFactoryImpl(this);
    4.19 -        Content link = factory.getLink(linkInfo);
    4.20 -        displayLength += linkInfo.displayLength;
    4.21 -        return link;
    4.22 +        return factory.getLink(linkInfo);
    4.23      }
    4.24  
    4.25      /**
     5.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java	Tue May 14 10:14:53 2013 -0700
     5.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java	Tue May 14 10:14:53 2013 -0700
     5.3 @@ -77,7 +77,6 @@
     5.4                      !classDoc.qualifiedTypeName().equals(classLinkInfo.type.qualifiedTypeName())) :
     5.5              "";
     5.6          Content label = classLinkInfo.getClassLinkLabel(m_writer.configuration);
     5.7 -        classLinkInfo.displayLength += label.charCount();
     5.8          Configuration configuration = m_writer.configuration;
     5.9          Content link = new ContentBuilder();
    5.10          if (classDoc.isIncluded()) {
    5.11 @@ -128,9 +127,7 @@
    5.12          typeLinkInfo.excludeTypeParameterLinks = linkInfo.excludeTypeParameterLinks;
    5.13          typeLinkInfo.linkToSelf = linkInfo.linkToSelf;
    5.14          typeLinkInfo.isJava5DeclarationLocation = false;
    5.15 -        Content output = getLink(typeLinkInfo);
    5.16 -        ((LinkInfoImpl) linkInfo).displayLength += typeLinkInfo.displayLength;
    5.17 -        return output;
    5.18 +        return getLink(typeLinkInfo);
    5.19      }
    5.20  
    5.21      protected Content getTypeAnnotationLink(LinkInfo linkInfo,
    5.22 @@ -157,14 +154,12 @@
    5.23          boolean isFirst = true;
    5.24          for (String anno : annos) {
    5.25              if (!isFirst) {
    5.26 -                linkInfo.displayLength += 1;
    5.27                  links.addContent(" ");
    5.28              }
    5.29              links.addContent(new RawHtml(anno));
    5.30              isFirst = false;
    5.31          }
    5.32          if (!annos.isEmpty()) {
    5.33 -            linkInfo.displayLength += 1;
    5.34              links.addContent(" ");
    5.35          }
    5.36  
     6.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java	Tue May 14 10:14:53 2013 -0700
     6.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/MethodWriterImpl.java	Tue May 14 10:14:53 2013 -0700
     6.3 @@ -117,7 +117,6 @@
     6.4       * @return a content object for the signature
     6.5       */
     6.6      public Content getSignature(MethodDoc method) {
     6.7 -        writer.displayLength = 0;
     6.8          Content pre = new HtmlTree(HtmlTag.PRE);
     6.9          writer.addAnnotationInfo(method, pre);
    6.10          addModifiers(method, pre);
    6.11 @@ -129,8 +128,9 @@
    6.12          } else {
    6.13              addName(method.name(), pre);
    6.14          }
    6.15 -        addParameters(method, pre);
    6.16 -        addExceptions(method, pre);
    6.17 +        int indent = pre.charCount();
    6.18 +        addParameters(method, pre, indent);
    6.19 +        addExceptions(method, pre, indent);
    6.20          return pre;
    6.21      }
    6.22  
     7.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/RawHtml.java	Tue May 14 10:14:53 2013 -0700
     7.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/RawHtml.java	Tue May 14 10:14:53 2013 -0700
     7.3 @@ -99,10 +99,14 @@
     7.4  
     7.5      @Override
     7.6      public int charCount() {
     7.7 +        return charCount(rawHtmlContent);
     7.8 +    }
     7.9 +
    7.10 +    static int charCount(String htmlText) {
    7.11          State state = State.TEXT;
    7.12          int count = 0;
    7.13 -        for (int i = 0; i < rawHtmlContent.length(); i++) {
    7.14 -            char c = rawHtmlContent.charAt(i);
    7.15 +        for (int i = 0; i < htmlText.length(); i++) {
    7.16 +            char c = htmlText.charAt(i);
    7.17              switch (state) {
    7.18                  case TEXT:
    7.19                      switch (c) {
     8.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/StringContent.java	Tue May 14 10:14:53 2013 -0700
     8.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/StringContent.java	Tue May 14 10:14:53 2013 -0700
     8.3 @@ -41,7 +41,7 @@
     8.4   *
     8.5   * @author Bhavesh Patel
     8.6   */
     8.7 -public class StringContent extends Content{
     8.8 +public class StringContent extends Content {
     8.9  
    8.10      private StringBuilder stringContent;
    8.11  
    8.12 @@ -92,7 +92,7 @@
    8.13      }
    8.14  
    8.15      public int charCount() {
    8.16 -        return stringContent.length();
    8.17 +        return RawHtml.charCount(stringContent.toString());
    8.18      }
    8.19  
    8.20      /**
     9.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java	Tue May 14 10:14:53 2013 -0700
     9.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/Content.java	Tue May 14 10:14:53 2013 -0700
     9.3 @@ -96,8 +96,13 @@
     9.4          return !isEmpty();
     9.5      }
     9.6  
     9.7 +    /**
     9.8 +     * Return the number of characters of plain text content in this object
     9.9 +     * (optional operation.)
    9.10 +     * @return the number of characters of plain text content in this
    9.11 +     */
    9.12      public int charCount() {
    9.13 -        throw new UnsupportedOperationException();
    9.14 +        return 0;
    9.15      }
    9.16  
    9.17      /**
    10.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkFactory.java	Tue May 14 10:14:53 2013 -0700
    10.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkFactory.java	Tue May 14 10:14:53 2013 -0700
    10.3 @@ -60,7 +60,6 @@
    10.4              Content link = newContent();
    10.5              if (type.isPrimitive()) {
    10.6                  //Just a primitive.
    10.7 -                linkInfo.displayLength += type.typeName().length();
    10.8                  link.addContent(type.typeName());
    10.9              } else if (type.asAnnotatedType() != null && type.dimension().length() == 0) {
   10.10                  link.addContent(getTypeAnnotationLinks(linkInfo));
   10.11 @@ -70,19 +69,16 @@
   10.12              } else if (type.asWildcardType() != null) {
   10.13                  //Wildcard type.
   10.14                  linkInfo.isTypeBound = true;
   10.15 -                linkInfo.displayLength += 1;
   10.16                  link.addContent("?");
   10.17                  WildcardType wildcardType = type.asWildcardType();
   10.18                  Type[] extendsBounds = wildcardType.extendsBounds();
   10.19                  for (int i = 0; i < extendsBounds.length; i++) {
   10.20 -                    linkInfo.displayLength += i > 0 ? 2 : 9;
   10.21                      link.addContent(i > 0 ? ", " : " extends ");
   10.22                      setBoundsLinkInfo(linkInfo, extendsBounds[i]);
   10.23                      link.addContent(getLink(linkInfo));
   10.24                  }
   10.25                  Type[] superBounds = wildcardType.superBounds();
   10.26                  for (int i = 0; i < superBounds.length; i++) {
   10.27 -                    linkInfo.displayLength += i > 0 ? 2 : 7;
   10.28                      link.addContent(i > 0 ? ", " : " super ");
   10.29                      setBoundsLinkInfo(linkInfo, superBounds[i]);
   10.30                      link.addContent(getLink(linkInfo));
   10.31 @@ -101,7 +97,6 @@
   10.32                      link.addContent(getClassLink(linkInfo));
   10.33                  } else {
   10.34                      //No need to link method type parameters.
   10.35 -                    linkInfo.displayLength += type.typeName().length();
   10.36                      link.addContent(type.typeName());
   10.37                  }
   10.38  
   10.39 @@ -109,7 +104,6 @@
   10.40                  if (! linkInfo.excludeTypeBounds) {
   10.41                      linkInfo.excludeTypeBounds = true;
   10.42                      for (int i = 0; i < bounds.length; i++) {
   10.43 -                        linkInfo.displayLength += i > 0 ? 2 : 9;
   10.44                          link.addContent(i > 0 ? " & " : " extends ");
   10.45                          setBoundsLinkInfo(linkInfo, bounds[i]);
   10.46                          link.addContent(getLink(linkInfo));
   10.47 @@ -121,7 +115,6 @@
   10.48                          linkInfo.excludeTypeBoundsLinks) {
   10.49                      //Since we are excluding type parameter links, we should not
   10.50                      //be linking to the type bound.
   10.51 -                    linkInfo.displayLength += type.typeName().length();
   10.52                      link.addContent(type.typeName());
   10.53                      link.addContent(getTypeParameterLinks(linkInfo));
   10.54                      return link;
   10.55 @@ -139,14 +132,11 @@
   10.56                  if (type.dimension().length() > 2) {
   10.57                      //Javadoc returns var args as array.
   10.58                      //Strip out the first [] from the var arg.
   10.59 -                    linkInfo.displayLength += type.dimension().length()-2;
   10.60                      link.addContent(type.dimension().substring(2));
   10.61                  }
   10.62 -                linkInfo.displayLength += 3;
   10.63                  link.addContent("...");
   10.64              } else {
   10.65                  while (type != null && type.dimension().length() > 0) {
   10.66 -                    linkInfo.displayLength += type.dimension().length();
   10.67                      if (type.asAnnotatedType() != null) {
   10.68                          linkInfo.type = type;
   10.69                          link.addContent(" ");
   10.70 @@ -241,16 +231,13 @@
   10.71               (linkInfo.includeTypeAsSepLink && ! isClassLabel)
   10.72                )
   10.73              && vars.length > 0) {
   10.74 -            linkInfo.displayLength += 1;
   10.75              links.addContent("<");
   10.76              for (int i = 0; i < vars.length; i++) {
   10.77                  if (i > 0) {
   10.78 -                    linkInfo.displayLength += 1;
   10.79                      links.addContent(",");
   10.80                  }
   10.81                  links.addContent(getTypeParameterLink(linkInfo, vars[i]));
   10.82              }
   10.83 -            linkInfo.displayLength += 1;
   10.84              links.addContent(">");
   10.85          }
   10.86          return links;
   10.87 @@ -263,13 +250,11 @@
   10.88          AnnotationDesc[] annotations = linkInfo.type.asAnnotatedType().annotations();
   10.89          for (int i = 0; i < annotations.length; i++) {
   10.90              if (i > 0) {
   10.91 -                linkInfo.displayLength += 1;
   10.92                  links.addContent(" ");
   10.93              }
   10.94              links.addContent(getTypeAnnotationLink(linkInfo, annotations[i]));
   10.95          }
   10.96  
   10.97 -        linkInfo.displayLength += 1;
   10.98          links.addContent(" ");
   10.99          return links;
  10.100      }
    11.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkInfo.java	Tue May 14 10:14:53 2013 -0700
    11.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/util/links/LinkInfo.java	Tue May 14 10:14:53 2013 -0700
    11.3 @@ -91,7 +91,7 @@
    11.4      public boolean includeTypeInClassLinkLabel = true;
    11.5  
    11.6      /**
    11.7 -     * True if we should include the type as seperate link.  False otherwise.
    11.8 +     * True if we should include the type as separate link.  False otherwise.
    11.9       */
   11.10      public boolean includeTypeAsSepLink = false;
   11.11  
   11.12 @@ -117,11 +117,6 @@
   11.13      public boolean linkToSelf = true;
   11.14  
   11.15      /**
   11.16 -     * The display length for the link.
   11.17 -     */
   11.18 -    public int displayLength = 0;
   11.19 -
   11.20 -    /**
   11.21       * Return an empty instance of a content object.
   11.22       *
   11.23       * @return an empty instance of a content object.
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/test/com/sun/javadoc/testIndentation/TestIndentation.java	Tue May 14 10:14:53 2013 -0700
    12.3 @@ -0,0 +1,77 @@
    12.4 +/*
    12.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    12.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    12.7 + *
    12.8 + * This code is free software; you can redistribute it and/or modify it
    12.9 + * under the terms of the GNU General Public License version 2 only, as
   12.10 + * published by the Free Software Foundation.
   12.11 + *
   12.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   12.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   12.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   12.15 + * version 2 for more details (a copy is included in the LICENSE file that
   12.16 + * accompanied this code).
   12.17 + *
   12.18 + * You should have received a copy of the GNU General Public License version
   12.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   12.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   12.21 + *
   12.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   12.23 + * or visit www.oracle.com if you need additional information or have any
   12.24 + * questions.
   12.25 + */
   12.26 +
   12.27 +/*
   12.28 + * @test
   12.29 + * @bug      8011288
   12.30 + * @summary  Erratic/inconsistent indentation of signatures
   12.31 + * @library  ../lib/
   12.32 + * @build    JavadocTester
   12.33 + * @run main TestIndentation
   12.34 + */
   12.35 +
   12.36 +public class TestIndentation extends JavadocTester {
   12.37 +
   12.38 +    //Test information.
   12.39 +    private static final String BUG_ID = "8011288";
   12.40 +
   12.41 +    //Javadoc arguments.
   12.42 +    private static final String[] ARGS = new String[] {
   12.43 +        "-d", BUG_ID, "-sourcepath", SRC_DIR, "p"
   12.44 +    };
   12.45 +
   12.46 +    //Input for string search tests.
   12.47 +    private static final String[][] TEST = {
   12.48 +        { BUG_ID + FS + "p" + FS + "Indent.html",
   12.49 +          "<pre>public&nbsp;&lt;T&gt;&nbsp;void&nbsp;m(T&nbsp;t1," },
   12.50 +        { BUG_ID + FS + "p" + FS + "Indent.html",
   12.51 +          NL + "                  T&nbsp;t2)" },
   12.52 +        { BUG_ID + FS + "p" + FS + "Indent.html",
   12.53 +          NL + "           throws java.lang.Exception" }
   12.54 +    };
   12.55 +    private static final String[][] NEGATED_TEST = NO_TEST;
   12.56 +
   12.57 +    /**
   12.58 +     * The entry point of the test.
   12.59 +     * @param args the array of command line arguments.
   12.60 +     */
   12.61 +    public static void main(String[] args) {
   12.62 +        TestIndentation tester = new TestIndentation();
   12.63 +        run(tester, ARGS, TEST, NEGATED_TEST);
   12.64 +        tester.printSummary();
   12.65 +    }
   12.66 +
   12.67 +    /**
   12.68 +     * {@inheritDoc}
   12.69 +     */
   12.70 +    public String getBugId() {
   12.71 +        return BUG_ID;
   12.72 +    }
   12.73 +
   12.74 +    /**
   12.75 +     * {@inheritDoc}
   12.76 +     */
   12.77 +    public String getBugName() {
   12.78 +        return getClass().getName();
   12.79 +    }
   12.80 +}
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/test/com/sun/javadoc/testIndentation/p/Indent.java	Tue May 14 10:14:53 2013 -0700
    13.3 @@ -0,0 +1,28 @@
    13.4 +/*
    13.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
    13.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    13.7 + *
    13.8 + * This code is free software; you can redistribute it and/or modify it
    13.9 + * under the terms of the GNU General Public License version 2 only, as
   13.10 + * published by the Free Software Foundation.
   13.11 + *
   13.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   13.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   13.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   13.15 + * version 2 for more details (a copy is included in the LICENSE file that
   13.16 + * accompanied this code).
   13.17 + *
   13.18 + * You should have received a copy of the GNU General Public License version
   13.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   13.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   13.21 + *
   13.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   13.23 + * or visit www.oracle.com if you need additional information or have any
   13.24 + * questions.
   13.25 + */
   13.26 +
   13.27 +package p;
   13.28 +
   13.29 +public class Indent {
   13.30 +    public <T> void m(T t1, T t2) throws Exception { }
   13.31 +}
    14.1 --- a/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java	Tue May 14 10:14:53 2013 -0700
    14.2 +++ b/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java	Tue May 14 10:14:53 2013 -0700
    14.3 @@ -235,8 +235,8 @@
    14.4                  "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">" +
    14.5                  "optional</a>=\"Parameter Annotation\",<a " +
    14.6                  "href=\"../pkg/AnnotationType.html#required()\">required</a>=1994)" + NL +
    14.7 -                "                    int&nbsp;documented," + NL +
    14.8 -                "                    int&nbsp;undocmented)</pre>"},
    14.9 +                "                             int&nbsp;documented," + NL +
   14.10 +                "                             int&nbsp;undocmented)</pre>"},
   14.11  
   14.12              //CONSTRUCTOR PARAMS
   14.13              {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
   14.14 @@ -245,8 +245,8 @@
   14.15                  "@AnnotationType</a>(<a href=\"../pkg/AnnotationType.html#optional()\">" +
   14.16                  "optional</a>=\"Constructor Param Annotation\",<a " +
   14.17                  "href=\"../pkg/AnnotationType.html#required()\">required</a>=1994)" + NL +
   14.18 -                "                   int&nbsp;documented," + NL +
   14.19 -                "                   int&nbsp;undocmented)</pre>"},
   14.20 +                "                           int&nbsp;documented," + NL +
   14.21 +                "                           int&nbsp;undocmented)</pre>"},
   14.22  
   14.23              //=================================
   14.24              // ANNOTATION TYPE USAGE TESTING (All Different Types).
   14.25 @@ -443,7 +443,7 @@
   14.26                       "<td class=\"colFirst\"><code>&lt;T extends <a href=\"../" +
   14.27                       "../pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest" +
   14.28                       "</a>&lt;<a href=\"../../pkg2/Foo3.html\" title=\"class in " +
   14.29 -                     "pkg2\">Foo3</a>&gt;&gt;&nbsp;<br><a href=\"../../pkg2/" +
   14.30 +                     "pkg2\">Foo3</a>&gt;&gt;<br><a href=\"../../pkg2/" +
   14.31                       "ParamTest.html\" title=\"class in pkg2\">ParamTest</a>" +
   14.32                       "&lt;<a href=\"../../pkg2/Foo3.html\" title=\"class in " +
   14.33                       "pkg2\">Foo3</a>&gt;</code></td>"
   14.34 @@ -486,7 +486,7 @@
   14.35                       "<td class=\"colFirst\"><code>&lt;T extends <a href=\"../../" +
   14.36                       "pkg2/ParamTest.html\" title=\"class in pkg2\">ParamTest</a>&lt;" +
   14.37                       "<a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">Foo3" +
   14.38 -                     "</a>&gt;&gt;&nbsp;<br><a href=\"../../pkg2/ParamTest.html\" " +
   14.39 +                     "</a>&gt;&gt;<br><a href=\"../../pkg2/ParamTest.html\" " +
   14.40                       "title=\"class in pkg2\">ParamTest</a>&lt;<a href=\"../../pkg2/" +
   14.41                       "Foo3.html\" title=\"class in pkg2\">Foo3</a>&gt;</code></td>"
   14.42              },
   14.43 @@ -524,7 +524,7 @@
   14.44                       "../pkg2/ParamTest2.html\" title=\"class in pkg2\">" +
   14.45                       "ParamTest2</a>&lt;java.util.List&lt;? extends <a href=\".." +
   14.46                       "/../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</a>&gt;" +
   14.47 -                     "&gt;&gt;&nbsp;<br><a href=\"../../pkg2/ParamTest2.html\" " +
   14.48 +                     "&gt;&gt;<br><a href=\"../../pkg2/ParamTest2.html\" " +
   14.49                       "title=\"class in pkg2\">ParamTest2</a>&lt;java.util.List" +
   14.50                       "&lt;? extends <a href=\"../../pkg2/Foo4.html\" title=\"" +
   14.51                       "class in pkg2\">Foo4</a>&gt;&gt;</code></td>"
   14.52 @@ -569,7 +569,7 @@
   14.53                       "../pkg2/ParamTest2.html\" title=\"class in pkg2\">" +
   14.54                       "ParamTest2</a>&lt;java.util.List&lt;? extends <a href=\".." +
   14.55                       "/../pkg2/Foo4.html\" title=\"class in pkg2\">Foo4</a>&gt;" +
   14.56 -                     "&gt;&gt;&nbsp;<br><a href=\"../../pkg2/ParamTest2.html\" " +
   14.57 +                     "&gt;&gt;<br><a href=\"../../pkg2/ParamTest2.html\" " +
   14.58                       "title=\"class in pkg2\">ParamTest2</a>&lt;java.util.List" +
   14.59                       "&lt;? extends <a href=\"../../pkg2/Foo4.html\" title=\"" +
   14.60                       "class in pkg2\">Foo4</a>&gt;&gt;</code></td>"
    15.1 --- a/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java	Tue May 14 10:14:53 2013 -0700
    15.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java	Tue May 14 10:14:53 2013 -0700
    15.3 @@ -266,14 +266,14 @@
    15.4          // Test for type annotations on throws (Throws.java).
    15.5          {BUG_ID + FS + "typeannos" + FS + "ThrDefaultUnmodified.html",
    15.6              "<pre>void&nbsp;oneException()" + NL +
    15.7 -            "            throws <a href=\"../typeannos/ThrA.html\" title=\"" +
    15.8 +            "           throws <a href=\"../typeannos/ThrA.html\" title=\"" +
    15.9              "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>"
   15.10          },
   15.11          {BUG_ID + FS + "typeannos" + FS + "ThrDefaultUnmodified.html",
   15.12              "<pre>void&nbsp;twoExceptions()" + NL +
   15.13 -            "             throws <a href=\"../typeannos/ThrA.html\" title=\"" +
   15.14 +            "            throws <a href=\"../typeannos/ThrA.html\" title=\"" +
   15.15              "annotation in typeannos\">@ThrA</a> java.lang.RuntimeException," + NL +
   15.16 -            "                    <a href=\"../typeannos/ThrA.html\" title=\"" +
   15.17 +            "                   <a href=\"../typeannos/ThrA.html\" title=\"" +
   15.18              "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>"
   15.19          },
   15.20          {BUG_ID + FS + "typeannos" + FS + "ThrPublicModified.html",
   15.21 @@ -290,16 +290,16 @@
   15.22          },
   15.23          {BUG_ID + FS + "typeannos" + FS + "ThrWithValue.html",
   15.24              "<pre>void&nbsp;oneException()" + NL +
   15.25 -            "            throws <a href=\"../typeannos/ThrB.html\" title=\"" +
   15.26 +            "           throws <a href=\"../typeannos/ThrB.html\" title=\"" +
   15.27              "annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/" +
   15.28              "ThrB.html#value()\">value</a>=\"m\") java.lang.Exception</pre>"
   15.29          },
   15.30          {BUG_ID + FS + "typeannos" + FS + "ThrWithValue.html",
   15.31              "<pre>void&nbsp;twoExceptions()" + NL +
   15.32 -            "             throws <a href=\"../typeannos/ThrB.html\" title=\"" +
   15.33 +            "            throws <a href=\"../typeannos/ThrB.html\" title=\"" +
   15.34              "annotation in typeannos\">@ThrB</a>(<a href=\"../typeannos/" +
   15.35              "ThrB.html#value()\">value</a>=\"m\") java.lang.RuntimeException," + NL +
   15.36 -            "                    <a href=\"../typeannos/ThrA.html\" title=\"" +
   15.37 +            "                   <a href=\"../typeannos/ThrA.html\" title=\"" +
   15.38              "annotation in typeannos\">@ThrA</a> java.lang.Exception</pre>"
   15.39          },
   15.40  
   15.41 @@ -342,7 +342,7 @@
   15.42          {BUG_ID + FS + "typeannos" + FS + "DefaultUnmodified.html",
   15.43              "<pre>void&nbsp;withException(<a href=\"../typeannos/RcvrA.html\" " +
   15.44              "title=\"annotation in typeannos\">@RcvrA</a>&nbsp;" +
   15.45 -            "DefaultUnmodified&nbsp;this)" + NL + "             throws java." +
   15.46 +            "DefaultUnmodified&nbsp;this)" + NL + "            throws java." +
   15.47              "lang.Exception</pre>"
   15.48          },
   15.49          {BUG_ID + FS + "typeannos" + FS + "DefaultUnmodified.html",
   15.50 @@ -356,8 +356,8 @@
   15.51              "<pre>&lt;T extends java.lang.Runnable&gt;&nbsp;void&nbsp;accept(" +
   15.52              "<a href=\"../typeannos/RcvrA.html\" title=\"annotation in " +
   15.53              "typeannos\">@RcvrA</a>&nbsp;DefaultUnmodified&nbsp;this," + NL +
   15.54 -            "                                         T&nbsp;r)" + NL +
   15.55 -            "      throws java.lang.Exception</pre>"
   15.56 +            "                                           T&nbsp;r)" + NL +
   15.57 +            "                                    throws java.lang.Exception</pre>"
   15.58          },
   15.59          {BUG_ID + FS + "typeannos" + FS + "PublicModified.html",
   15.60              "<pre>public final&nbsp;java.lang.String&nbsp;nonVoid(<a href=\"" +
   15.61 @@ -368,16 +368,16 @@
   15.62              "<pre>public final&nbsp;&lt;T extends java.lang.Runnable&gt;&nbsp;" +
   15.63              "void&nbsp;accept(<a href=\"../typeannos/RcvrA.html\" title=\"" +
   15.64              "annotation in typeannos\">@RcvrA</a>&nbsp;PublicModified&nbsp;this," + NL +
   15.65 -            "                                         T&nbsp;r)" + NL +
   15.66 -            "                  throws java.lang.Exception</pre>"
   15.67 +            "                                                        T&nbsp;r)" + NL +
   15.68 +            "                                                 throws java.lang.Exception</pre>"
   15.69          },
   15.70          {BUG_ID + FS + "typeannos" + FS + "WithValue.html",
   15.71              "<pre>&lt;T extends java.lang.Runnable&gt;&nbsp;void&nbsp;accept(" +
   15.72              "<a href=\"../typeannos/RcvrB.html\" title=\"annotation in " +
   15.73              "typeannos\">@RcvrB</a>(<a href=\"../typeannos/RcvrB.html#value()\">" +
   15.74              "value</a>=\"m\")&nbsp;WithValue&nbsp;this," + NL +
   15.75 -            "                                         T&nbsp;r)" + NL +
   15.76 -            "      throws java.lang.Exception</pre>"
   15.77 +            "                                           T&nbsp;r)" + NL +
   15.78 +            "                                    throws java.lang.Exception</pre>"
   15.79          },
   15.80          {BUG_ID + FS + "typeannos" + FS + "WithFinal.html",
   15.81              "<pre>java.lang.String&nbsp;nonVoid(<a href=\"../typeannos/RcvrB." +
    16.1 --- a/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java	Tue May 14 10:14:53 2013 -0700
    16.2 +++ b/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java	Tue May 14 10:14:53 2013 -0700
    16.3 @@ -1,5 +1,5 @@
    16.4  /*
    16.5 - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
    16.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
    16.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    16.8   *
    16.9   * This code is free software; you can redistribute it and/or modify it
   16.10 @@ -54,7 +54,7 @@
   16.11      private static final String[][] TEST1 = {
   16.12          {BUG_ID + FS + "pkg" + FS + "C.html",
   16.13              "<td class=\"colFirst\"><code>&lt;W extends java.lang.String,V extends " +
   16.14 -            "java.util.List&gt;&nbsp;<br>java.lang.Object</code></td>"
   16.15 +            "java.util.List&gt;<br>java.lang.Object</code></td>"
   16.16          },
   16.17          {BUG_ID + FS + "pkg" + FS + "C.html",
   16.18              "<code>&lt;T&gt;&nbsp;java.lang.Object</code>"

mercurial