Mercurial > hg > openjdk > aarch64-port > langtools
changeset 1861:27bd6a2302f6
8014017: extra space in javadoc class heading
Reviewed-by: jjg
author | bpatel |
---|---|
date | Wed, 26 Jun 2013 20:42:43 -0700 |
parents | 4fe5aab73bb2 |
children | 36e8bc1907a2 |
files | src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java |
diffstat | 3 files changed, 23 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java Wed Jun 26 20:38:21 2013 -0700 +++ b/src/share/classes/com/sun/tools/doclets/internal/toolkit/builders/ClassBuilder.java Wed Jun 26 20:42:43 2013 -0700 @@ -289,7 +289,8 @@ * @param classInfoTree the content tree to which the documentation will be added */ public void buildClassSignature(XMLNode node, Content classInfoTree) { - StringBuilder modifiers = new StringBuilder(classDoc.modifiers() + " "); + StringBuilder modifiers = new StringBuilder(classDoc.modifiers()); + modifiers.append(modifiers.length() == 0 ? "" : " "); if (isEnum) { modifiers.append("enum "); int index;
--- a/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java Wed Jun 26 20:38:21 2013 -0700 +++ b/test/com/sun/javadoc/testPrivateClasses/TestPrivateClasses.java Wed Jun 26 20:42:43 2013 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -23,7 +23,7 @@ /* * @test - * @bug 4780441 4874845 4978816 + * @bug 4780441 4874845 4978816 8014017 * @summary Make sure that when the -private flag is not used, members * inherited from package private class are documented in the child. * @@ -33,17 +33,19 @@ * * Make sure that when a private interface method with generic parameters * is implemented, the comments can be inherited properly. + * + * Make sure when no modifier appear in the class signature, the + * signature is displayed correctly without extra space at the beginning. * @author jamieh * @library ../lib/ - * @build JavadocTester - * @build TestPrivateClasses + * @build JavadocTester TestPrivateClasses * @run main TestPrivateClasses */ public class TestPrivateClasses extends JavadocTester { //Test information. - private static final String BUG_ID = "4780441-4874845-4978816"; + private static final String BUG_ID = "4780441-4874845-4978816-8014017"; //Javadoc arguments. private static final String[] ARGS1 = new String[] { @@ -234,8 +236,19 @@ " in interface <code>" + "<a href=\"../pkg2/I.html\" title=\"interface in pkg2\">I</a>" + "<java.lang.String></code></dd>"}, + + //Make sure when no modifier appear in the class signature, the + //signature is displayed correctly without extra space at the beginning. + {BUG_ID + "-2" + FS + "pkg" + FS + "PrivateParent.html", + "<pre>class <span class=\"strong\">PrivateParent</span>"}, + + {BUG_ID + "-2" + FS + "pkg" + FS + "PublicChild.html", + "<pre>public class <span class=\"strong\">PublicChild</span>"}, }; - private static final String[][] NEGATED_TEST2 = NO_TEST; + private static final String[][] NEGATED_TEST2 = { + {BUG_ID + "-2" + FS + "pkg" + FS + "PrivateParent.html", + "<pre> class <span class=\"strong\">PrivateParent</span>"}, + }; /** * The entry point of the test.
--- a/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java Wed Jun 26 20:38:21 2013 -0700 +++ b/test/com/sun/javadoc/testTypeAnnotations/TestTypeAnnotations.java Wed Jun 26 20:42:43 2013 -0700 @@ -78,7 +78,7 @@ "typeannos\">@ClassParamA</a> java.lang.String></span>" }, {BUG_ID + FS + "typeannos" + FS + "ExtendsGeneric.html", - "<pre> class <span class=\"strong\">ExtendsGeneric<K extends " + + "<pre>class <span class=\"strong\">ExtendsGeneric<K extends " + "<a href=\"../typeannos/ClassParamA.html\" title=\"annotation in " + "typeannos\">@ClassParamA</a> <a href=\"../typeannos/Unannotated.html\" " + "title=\"class in typeannos\">Unannotated</a><<a href=\"" + @@ -86,7 +86,7 @@ "@ClassParamB</a> java.lang.String>></span>" }, {BUG_ID + FS + "typeannos" + FS + "TwoBounds.html", - "<pre> class <span class=\"strong\">TwoBounds<K extends <a href=\"" + + "<pre>class <span class=\"strong\">TwoBounds<K extends <a href=\"" + "../typeannos/ClassParamA.html\" title=\"annotation in typeannos\">" + "@ClassParamA</a> java.lang.String,V extends <a href=\"../typeannos/" + "ClassParamB.html\" title=\"annotation in typeannos\">@ClassParamB" +