8014017: extra space in javadoc class heading

Wed, 26 Jun 2013 20:42:43 -0700

author
bpatel
date
Wed, 26 Jun 2013 20:42:43 -0700
changeset 1858
27bd6a2302f6
parent 1857
4fe5aab73bb2
child 1859
36e8bc1907a2

8014017: extra space in javadoc class heading
Reviewed-by: jjg

src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java file | annotate | diff | comparison | revisions
test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java file | annotate | diff | comparison | revisions
test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java	Wed Jun 26 20:38:21 2013 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java	Wed Jun 26 20:42:43 2013 -0700
     1.3 @@ -289,7 +289,8 @@
     1.4       * @param classInfoTree the content tree to which the documentation will be added
     1.5       */
     1.6      public void buildClassSignature(XMLNode node, Content classInfoTree) {
     1.7 -        StringBuilder modifiers = new StringBuilder(classDoc.modifiers() + " ");
     1.8 +        StringBuilder modifiers = new StringBuilder(classDoc.modifiers());
     1.9 +        modifiers.append(modifiers.length() == 0 ? "" : " ");
    1.10          if (isEnum) {
    1.11              modifiers.append("enum ");
    1.12              int index;
     2.1 --- a/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java	Wed Jun 26 20:38:21 2013 -0700
     2.2 +++ b/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java	Wed Jun 26 20:42:43 2013 -0700
     2.3 @@ -1,5 +1,5 @@
     2.4  /*
     2.5 - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
     2.6 + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
     2.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     2.8   *
     2.9   * This code is free software; you can redistribute it and/or modify it
    2.10 @@ -23,7 +23,7 @@
    2.11  
    2.12  /*
    2.13   * @test
    2.14 - * @bug      4780441 4874845 4978816
    2.15 + * @bug      4780441 4874845 4978816 8014017
    2.16   * @summary  Make sure that when the -private flag is not used, members
    2.17   *           inherited from package private class are documented in the child.
    2.18   *
    2.19 @@ -33,17 +33,19 @@
    2.20   *
    2.21   *           Make sure that when a private interface method with generic parameters
    2.22   *           is implemented, the comments can be inherited properly.
    2.23 + *
    2.24 + *           Make sure when no modifier appear in the class signature, the
    2.25 + *           signature is displayed correctly without extra space at the beginning.
    2.26   * @author   jamieh
    2.27   * @library  ../lib/
    2.28 - * @build    JavadocTester
    2.29 - * @build    TestPrivateClasses
    2.30 + * @build    JavadocTester TestPrivateClasses
    2.31   * @run main TestPrivateClasses
    2.32   */
    2.33  
    2.34  public class TestPrivateClasses extends JavadocTester {
    2.35  
    2.36      //Test information.
    2.37 -    private static final String BUG_ID = "4780441-4874845-4978816";
    2.38 +    private static final String BUG_ID = "4780441-4874845-4978816-8014017";
    2.39  
    2.40      //Javadoc arguments.
    2.41      private static final String[] ARGS1 = new String[] {
    2.42 @@ -234,8 +236,19 @@
    2.43              "&nbsp;in interface&nbsp;<code>" +
    2.44              "<a href=\"../pkg2/I.html\" title=\"interface in pkg2\">I</a>" +
    2.45              "&lt;java.lang.String&gt;</code></dd>"},
    2.46 +
    2.47 +      //Make sure when no modifier appear in the class signature, the
    2.48 +      //signature is displayed correctly without extra space at the beginning.
    2.49 +      {BUG_ID + "-2" + FS + "pkg" + FS + "PrivateParent.html",
    2.50 +            "<pre>class <span class=\"strong\">PrivateParent</span>"},
    2.51 +
    2.52 +      {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html",
    2.53 +            "<pre>public class <span class=\"strong\">PublicChild</span>"},
    2.54      };
    2.55 -    private static final String[][] NEGATED_TEST2 = NO_TEST;
    2.56 +    private static final String[][] NEGATED_TEST2 = {
    2.57 +        {BUG_ID + "-2" + FS + "pkg" + FS + "PrivateParent.html",
    2.58 +            "<pre> class <span class=\"strong\">PrivateParent</span>"},
    2.59 +    };
    2.60  
    2.61      /**
    2.62       * The entry point of the test.
     3.1 --- a/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java	Wed Jun 26 20:38:21 2013 -0700
     3.2 +++ b/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java	Wed Jun 26 20:42:43 2013 -0700
     3.3 @@ -78,7 +78,7 @@
     3.4              "typeannos\">@ClassParamA</a> java.lang.String&gt;</span>"
     3.5          },
     3.6          {BUG_ID + FS + "typeannos" + FS + "ExtendsGeneric.html",
     3.7 -            "<pre> class <span class=\"strong\">ExtendsGeneric&lt;K extends " +
     3.8 +            "<pre>class <span class=\"strong\">ExtendsGeneric&lt;K extends " +
     3.9              "<a href=\"../typeannos/ClassParamA.html\" title=\"annotation in " +
    3.10              "typeannos\">@ClassParamA</a> <a href=\"../typeannos/Unannotated.html\" " +
    3.11              "title=\"class in typeannos\">Unannotated</a>&lt;<a href=\"" +
    3.12 @@ -86,7 +86,7 @@
    3.13              "@ClassParamB</a> java.lang.String&gt;&gt;</span>"
    3.14          },
    3.15          {BUG_ID + FS + "typeannos" + FS + "TwoBounds.html",
    3.16 -            "<pre> class <span class=\"strong\">TwoBounds&lt;K extends <a href=\"" +
    3.17 +            "<pre>class <span class=\"strong\">TwoBounds&lt;K extends <a href=\"" +
    3.18              "../typeannos/ClassParamA.html\" title=\"annotation in typeannos\">" +
    3.19              "@ClassParamA</a> java.lang.String,V extends <a href=\"../typeannos/" +
    3.20              "ClassParamB.html\" title=\"annotation in typeannos\">@ClassParamB" +

mercurial