6820360: Fix for definition list tags nesting adds an extra list tag for package summary page.
authorbpatel
Fri, 20 Mar 2009 15:50:50 -0700
changeset 2321 57fc341671c4
parent 2320 5b8c377175f4
child 2322 5250b269afaa
6820360: Fix for definition list tags nesting adds an extra list tag for package summary page. Reviewed-by: jjg
langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java
langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java
langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/package-info.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Thu Mar 19 19:00:54 2009 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Fri Mar 20 15:50:50 2009 -0700
@@ -236,17 +236,19 @@
             configuration.tagletManager.getCustomTags(doc),
                 getTagletWriterInstance(false), output);
         String outputString = output.toString().trim();
-        // For RootDoc and ClassDoc, this section is not the definition description
-        // but the start of definition list.
+        // For RootDoc, ClassDoc and PackageDoc, this section is not the
+        // definition description but the start of definition list.
         if (!outputString.isEmpty()) {
-            if (!(doc instanceof RootDoc || doc instanceof ClassDoc)) {
+            if (!(doc instanceof RootDoc || doc instanceof ClassDoc ||
+                    doc instanceof PackageDoc)) {
                 printMemberDetailsListStartTag();
                 dd();
             }
             printTagsInfoHeader();
             print(outputString);
             printTagsInfoFooter();
-            if (!(doc instanceof RootDoc || doc instanceof ClassDoc))
+            if (!(doc instanceof RootDoc || doc instanceof ClassDoc ||
+                    doc instanceof PackageDoc))
                 ddEnd();
         }
     }
--- a/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java	Thu Mar 19 19:00:54 2009 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java	Fri Mar 20 15:50:50 2009 -0700
@@ -25,7 +25,7 @@
 
 /*
  * @test
- * @bug 6786690
+ * @bug 6786690 6820360
  * @summary This test verifies the nesting of definition list tags.
  * @author Bhavesh Patel
  * @library ../lib/
@@ -36,7 +36,7 @@
 
 public class TestHtmlDefinitionListTag extends JavadocTester {
 
-    private static final String BUG_ID = "6786690";
+    private static final String BUG_ID = "6786690-6820360";
 
     // Test common to all runs of javadoc. The class signature should print
     // properly enclosed definition list tags and the Annotation Type
@@ -55,6 +55,9 @@
     // serialized form should have properly nested definition list tags
     // enclosing comments, tags and deprecated information.
     private static final String[][] TEST_CMNT_DEPR = {
+        {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<DL>" + NL +
+                 "<DT><STRONG>Since:</STRONG></DT>" + NL +
+                 "  <DD>JDK1.0</DD></DL>"},
         {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL>" + NL +
                  "<DT><STRONG>Since:</STRONG></DT>" + NL +
                  "  <DD>JDK1.0</DD>" + NL + "<DT><STRONG>See Also:</STRONG></DT><DD>" +
@@ -193,6 +196,9 @@
     // should display properly nested definition list tags for comments, tags
     // and deprecated information.
     private static final String[][] TEST_NODEPR = {
+        {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<DL>" + NL +
+                 "<DT><STRONG>Since:</STRONG></DT>" + NL +
+                 "  <DD>JDK1.0</DD></DL>"},
         {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL>" + NL +
                  "<DT><STRONG>Since:</STRONG></DT>" + NL +
                  "  <DD>JDK1.0</DD>" + NL + "<DT><STRONG>See Also:</STRONG></DT><DD>" +
@@ -302,6 +308,8 @@
     // Test for valid HTML generation which should not comprise of empty
     // definition list tags.
     private static final String[][] NEGATED_TEST = {
+        {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<DL></DL>"},
+        {BUG_ID + FS + "pkg1" + FS + "package-summary.html", "<DL>" + NL + "</DL>"},
         {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL></DL>"},
         {BUG_ID + FS + "pkg1" + FS + "C1.html", "<DL>" + NL + "</DL>"},
         {BUG_ID + FS + "pkg1" + FS + "C1.ModalExclusionType.html", "<DL></DL>"},
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/pkg1/package-info.java	Fri Mar 20 15:50:50 2009 -0700
@@ -0,0 +1,29 @@
+/*
+ * Copyright 2009 Sun Microsystems, Inc.  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
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/**
+ * Test package 1.
+ *
+ * @since JDK1.0
+ */
+package pkg1;