Tue, 15 Oct 2013 11:20:27 -0700
8026370: javadoc creates empty <span class="italic"></span>
Reviewed-by: jjg
1.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java Tue Oct 15 16:23:18 2013 +0200 1.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/TagletWriterImpl.java Tue Oct 15 11:20:27 2013 -0700 1.3 @@ -118,7 +118,8 @@ 1.4 if (deprs.length > 0) { 1.5 Content body = commentTagsToOutput(null, doc, 1.6 deprs[0].inlineTags(), false); 1.7 - result.addContent(HtmlTree.SPAN(HtmlStyle.italic, body)); 1.8 + if (!body.isEmpty()) 1.9 + result.addContent(HtmlTree.SPAN(HtmlStyle.italic, body)); 1.10 } 1.11 } else { 1.12 if (Util.isDeprecated(member.containingClass())) {
2.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/ContentBuilder.java Tue Oct 15 16:23:18 2013 +0200 2.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/ContentBuilder.java Tue Oct 15 11:20:27 2013 -0700 2.3 @@ -41,8 +41,6 @@ 2.4 @Override 2.5 public void addContent(Content content) { 2.6 nullCheck(content); 2.7 - if ((content instanceof ContentBuilder) && content.isEmpty()) 2.8 - return; 2.9 ensureMutableContents(); 2.10 if (content instanceof ContentBuilder) { 2.11 contents.addAll(((ContentBuilder) content).contents);
3.1 --- a/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Tue Oct 15 16:23:18 2013 +0200 3.2 +++ b/src/share/classes/com/sun/tools/doclets/formats/html/markup/HtmlTree.java Tue Oct 15 11:20:27 2013 -0700 3.3 @@ -102,7 +102,12 @@ 3.4 * @param tagContent tag content to be added 3.5 */ 3.6 public void addContent(Content tagContent) { 3.7 - if (tagContent == HtmlTree.EMPTY || tagContent.isValid()) { 3.8 + if (tagContent instanceof ContentBuilder) { 3.9 + for (Content content: ((ContentBuilder)tagContent).contents) { 3.10 + addContent(content); 3.11 + } 3.12 + } 3.13 + else if (tagContent == HtmlTree.EMPTY || tagContent.isValid()) { 3.14 if (content.isEmpty()) 3.15 content = new ArrayList<Content>(); 3.16 content.add(tagContent);
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/test/com/sun/javadoc/testTagOutput/TestTagOutput.java Tue Oct 15 11:20:27 2013 -0700 4.3 @@ -0,0 +1,78 @@ 4.4 +/* 4.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.7 + * 4.8 + * This code is free software; you can redistribute it and/or modify it 4.9 + * under the terms of the GNU General Public License version 2 only, as 4.10 + * published by the Free Software Foundation. Oracle designates this 4.11 + * particular file as subject to the "Classpath" exception as provided 4.12 + * by Oracle in the LICENSE file that accompanied this code. 4.13 + * 4.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 4.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4.17 + * version 2 for more details (a copy is included in the LICENSE file that 4.18 + * accompanied this code). 4.19 + * 4.20 + * You should have received a copy of the GNU General Public License version 4.21 + * 2 along with this work; if not, write to the Free Software Foundation, 4.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4.23 + * 4.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4.25 + * or visit www.oracle.com if you need additional information or have any 4.26 + * questions. 4.27 + */ 4.28 + 4.29 +/* 4.30 + * @test 4.31 + * @bug 8026370 4.32 + * @summary This test checks the generated tag output. 4.33 + * @author Bhavesh Patel 4.34 + * @library ../lib/ 4.35 + * @build JavadocTester TestTagOutput 4.36 + * @run main TestTagOutput 4.37 + */ 4.38 + 4.39 +public class TestTagOutput extends JavadocTester { 4.40 + 4.41 + private static final String BUG_ID = "8026370"; 4.42 + private static final String[][] TEST = { 4.43 + {BUG_ID + FS + "pkg1" + FS + "DeprecatedTag.html", 4.44 + "<div class=\"block\"><span class=\"strong\">Deprecated.</span> </div>"}, 4.45 + {BUG_ID + FS + "pkg1" + FS + "DeprecatedTag.html", 4.46 + "<div class=\"block\"><span class=\"strong\">Deprecated.</span> " + 4.47 + "<span class=\"italic\">Do not use this.</span></div>"}}; 4.48 + 4.49 + private static final String[][] NEGATED_TEST = { 4.50 + {BUG_ID + FS + "pkg1" + FS + "DeprecatedTag.html", 4.51 + "<div class=\"block\"><span class=\"strong\">Deprecated." + 4.52 + "</span> <span class=\"italic\"></span></div>"}}; 4.53 + 4.54 + private static final String[] ARGS = 4.55 + new String[] { 4.56 + "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1"}; 4.57 + 4.58 + /** 4.59 + * The entry point of the test. 4.60 + * @param args the array of command line arguments. 4.61 + */ 4.62 + public static void main(String[] args) { 4.63 + TestTagOutput tester = new TestTagOutput(); 4.64 + run(tester, ARGS, TEST, NEGATED_TEST); 4.65 + tester.printSummary(); 4.66 + } 4.67 + 4.68 + /** 4.69 + * {@inheritDoc} 4.70 + */ 4.71 + public String getBugId() { 4.72 + return BUG_ID; 4.73 + } 4.74 + 4.75 + /** 4.76 + * {@inheritDoc} 4.77 + */ 4.78 + public String getBugName() { 4.79 + return getClass().getName(); 4.80 + } 4.81 +}
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/test/com/sun/javadoc/testTagOutput/pkg1/DeprecatedTag.java Tue Oct 15 11:20:27 2013 -0700 5.3 @@ -0,0 +1,44 @@ 5.4 +/* 5.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 5.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.7 + * 5.8 + * This code is free software; you can redistribute it and/or modify it 5.9 + * under the terms of the GNU General Public License version 2 only, as 5.10 + * published by the Free Software Foundation. 5.11 + * 5.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 5.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 5.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 5.15 + * version 2 for more details (a copy is included in the LICENSE file that 5.16 + * accompanied this code). 5.17 + * 5.18 + * You should have received a copy of the GNU General Public License version 5.19 + * 2 along with this work; if not, write to the Free Software Foundation, 5.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 5.21 + * 5.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 5.23 + * or visit www.oracle.com if you need additional information or have any 5.24 + * questions. 5.25 + */ 5.26 + 5.27 +package pkg1; 5.28 + 5.29 +public class DeprecatedTag { 5.30 + 5.31 + /** 5.32 + * This method is deprecated. 5.33 + * 5.34 + * @deprecated 5.35 + */ 5.36 + public void deprecatedMethod() { 5.37 + } 5.38 + 5.39 + /** 5.40 + * This method is also deprecated. 5.41 + * 5.42 + * @deprecated Do not use this. 5.43 + */ 5.44 + public void deprecatedMethodWithDesc() { 5.45 + } 5.46 +} 5.47 +