7010344: Some of the html files do not have element <a> in right context.
authorbpatel
Mon, 04 Apr 2011 10:14:23 -0700
changeset 9083 63f3c4d2d992
parent 9082 53409a3a93f8
child 9085 7c9ef56ec288
7010344: Some of the html files do not have element <a> in right context. Reviewed-by: jjg
langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java
langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java
langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java
langtools/test/com/sun/javadoc/testHref/TestHref.java
langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java
langtools/test/com/sun/javadoc/testLinkOption/TestLinkOption.java
langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java
langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java
langtools/test/com/sun/javadoc/testTypeParams/pkg/ClassUseTest3.java
langtools/test/com/sun/javadoc/testTypeParams/pkg/Foo4.java
langtools/test/com/sun/javadoc/testTypeParams/pkg/ParamTest2.java
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java	Sun Apr 03 17:00:50 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/AnnotationTypeWriterImpl.java	Mon Apr 04 10:14:23 2011 -0700
@@ -216,12 +216,15 @@
         pre.addContent(modifiers);
         LinkInfoImpl linkInfo = new LinkInfoImpl(
                 LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, annotationType, false);
-        Content name = new RawHtml (annotationType.name() +
-                getTypeParameterLinks(linkInfo));
+        Content annotationName = new StringContent(annotationType.name());
+        Content parameterLinks = new RawHtml(getTypeParameterLinks(linkInfo));
         if (configuration().linksource) {
-            addSrcLink(annotationType, name, pre);
+            addSrcLink(annotationType, annotationName, pre);
+            pre.addContent(parameterLinks);
         } else {
-            pre.addContent(HtmlTree.STRONG(name));
+            Content span = HtmlTree.SPAN(HtmlStyle.strong, annotationName);
+            span.addContent(parameterLinks);
+            pre.addContent(span);
         }
         annotationInfoTree.addContent(pre);
     }
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Sun Apr 03 17:00:50 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/ClassWriterImpl.java	Mon Apr 04 10:14:23 2011 -0700
@@ -228,12 +228,15 @@
                 LinkInfoImpl.CONTEXT_CLASS_SIGNATURE, classDoc, false);
         //Let's not link to ourselves in the signature.
         linkInfo.linkToSelf = false;
-        Content name = new RawHtml (classDoc.name() +
-                getTypeParameterLinks(linkInfo));
+        Content className = new StringContent(classDoc.name());
+        Content parameterLinks = new RawHtml(getTypeParameterLinks(linkInfo));
         if (configuration().linksource) {
-            addSrcLink(classDoc, name, pre);
+            addSrcLink(classDoc, className, pre);
+            pre.addContent(parameterLinks);
         } else {
-            pre.addContent(HtmlTree.STRONG(name));
+            Content span = HtmlTree.SPAN(HtmlStyle.strong, className);
+            span.addContent(parameterLinks);
+            pre.addContent(span);
         }
         if (!isInterface) {
             Type superclass = Util.getFirstVisibleSuperClass(classDoc,
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java	Sun Apr 03 17:00:50 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkFactoryImpl.java	Mon Apr 04 10:14:23 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -69,9 +69,6 @@
         StringBuffer label = new StringBuffer(
             classLinkInfo.getClassLinkLabel(m_writer.configuration));
         classLinkInfo.displayLength += label.length();
-        if (noLabel && classLinkInfo.excludeTypeParameterLinks) {
-            label.append(getTypeParameterLinks(linkInfo).toString());
-        }
         Configuration configuration = ConfigurationImpl.getInstance();
         LinkOutputImpl linkOutput = new LinkOutputImpl();
         if (classDoc.isIncluded()) {
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java	Sun Apr 03 17:00:50 2011 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/LinkInfoImpl.java	Mon Apr 04 10:14:23 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -408,10 +408,6 @@
 
             case CONTEXT_PACKAGE:
             case CONTEXT_CLASS_USE:
-                excludeTypeBoundsLinks = true;
-                excludeTypeParameterLinks = true;
-                break;
-
             case CONTEXT_CLASS_HEADER:
             case CONTEXT_CLASS_SIGNATURE:
                 excludeTypeParameterLinks = true;
--- a/langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java	Sun Apr 03 17:00:50 2011 -0700
+++ b/langtools/test/com/sun/javadoc/testDeprecatedDocs/TestDeprecatedDocs.java	Mon Apr 04 10:14:23 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -27,8 +27,7 @@
  * @summary  <DESC>
  * @author   jamieh
  * @library  ../lib/
- * @build    JavadocTester
- * @build    TestDeprecatedDocs
+ * @build    JavadocTester TestDeprecatedDocs
  * @run main TestDeprecatedDocs
  */
 
@@ -77,7 +76,7 @@
         {TARGET_FILE, "pkg.DeprecatedClassByAnnotation.field"},
 
         {TARGET_FILE2, "<pre>@Deprecated" + NL +
-                 "public class <strong>DeprecatedClassByAnnotation</strong>" + NL +
+                 "public class <span class=\"strong\">DeprecatedClassByAnnotation</span>" + NL +
                  "extends java.lang.Object</pre>"},
 
         {TARGET_FILE2, "<pre>@Deprecated" + NL +
--- a/langtools/test/com/sun/javadoc/testHref/TestHref.java	Sun Apr 03 17:00:50 2011 -0700
+++ b/langtools/test/com/sun/javadoc/testHref/TestHref.java	Mon Apr 04 10:14:23 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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
@@ -27,8 +27,7 @@
  * @summary  Verify that spaces do not appear in hrefs and anchors.
  * @author   jamieh
  * @library  ../lib/
- * @build    JavadocTester
- * @build    TestHref
+ * @build    JavadocTester TestHref
  * @run main TestHref
  */
 
@@ -81,7 +80,7 @@
 
         //Signature does not link to the page itself.
         {BUG_ID + FS + "pkg" + FS + "C4.html",
-            "public abstract class <strong>C4&lt;E extends C4&lt;E&gt;&gt;</strong>"
+            "public abstract class <span class=\"strong\">C4&lt;E extends C4&lt;E&gt;&gt;</span>"
         },
     };
     private static final String[][] NEGATED_TEST =
--- a/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java	Sun Apr 03 17:00:50 2011 -0700
+++ b/langtools/test/com/sun/javadoc/testHtmlDefinitionListTag/TestHtmlDefinitionListTag.java	Mon Apr 04 10:14:23 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2011, 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
@@ -29,8 +29,7 @@
  * @summary This test verifies the nesting of definition list tags.
  * @author Bhavesh Patel
  * @library ../lib/
- * @build JavadocTester
- * @build TestHtmlDefinitionListTag
+ * @build JavadocTester TestHtmlDefinitionListTag
  * @run main TestHtmlDefinitionListTag
  */
 
@@ -43,7 +42,8 @@
     // Optional Element should print properly nested definition list tags
     // for default value.
     private static final String[][] TEST_ALL = {
-        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<pre>public class <strong>C1</strong>" + NL +
+        {BUG_ID + FS + "pkg1" + FS + "C1.html", "<pre>public class " +
+                 "<span class=\"strong\">C1</span>" + NL +
                  "extends java.lang.Object" + NL + "implements java.io.Serializable</pre>"},
         {BUG_ID + FS + "pkg1" + FS + "C4.html", "<dl>" + NL +
                  "<dt>Default:</dt>" + NL + "<dd>true</dd>" + NL +
--- a/langtools/test/com/sun/javadoc/testLinkOption/TestLinkOption.java	Sun Apr 03 17:00:50 2011 -0700
+++ b/langtools/test/com/sun/javadoc/testLinkOption/TestLinkOption.java	Mon Apr 04 10:14:23 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2011, 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
@@ -28,8 +28,7 @@
  * right files.
  * @author jamieh
  * @library ../lib/
- * @build JavadocTester
- * @build TestLinkOption
+ * @build JavadocTester TestLinkOption
  * @run main TestLinkOption
  */
 
@@ -62,7 +61,7 @@
                                 "Object</a>&nbsp;p3)"
         },
         {BUG_ID + "-1" + FS + "java" + FS + "lang" + FS + "StringBuilderChild.html",
-                "<pre>public abstract class <strong>StringBuilderChild</strong>" + NL +
+                "<pre>public abstract class <span class=\"strong\">StringBuilderChild</span>" + NL +
                 "extends <a href=\"http://java.sun.com/j2se/1.4/docs/api/java/lang/Object.html?is-external=true\" " +
                 "title=\"class or interface in java.lang\">Object</a></pre>"
         },
--- a/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java	Sun Apr 03 17:00:50 2011 -0700
+++ b/langtools/test/com/sun/javadoc/testNewLanguageFeatures/TestNewLanguageFeatures.java	Mon Apr 04 10:14:23 2011 -0700
@@ -23,14 +23,13 @@
 
 /*
  * @test
- * @bug      4789689 4905985 4927164 4827184 4993906 5004549 7025314
+ * @bug      4789689 4905985 4927164 4827184 4993906 5004549 7025314 7010344
  * @summary  Run Javadoc on a set of source files that demonstrate new
  *           language features.  Check the output to ensure that the new
  *           language features are properly documented.
  * @author   jamieh
  * @library  ../lib/
- * @build    JavadocTester
- * @build    TestNewLanguageFeatures
+ * @build    JavadocTester TestNewLanguageFeatures
  * @run main TestNewLanguageFeatures
  */
 
@@ -53,9 +52,10 @@
             //Make sure enum header is correct.
             {BUG_ID + FS + "pkg" + FS + "Coin.html", "Enum Coin</h2>"},
             //Make sure enum signature is correct.
-            {BUG_ID + FS + "pkg" + FS + "Coin.html", "<pre>public enum <strong>Coin</strong>" + NL +
-                "extends java.lang.Enum&lt;<a href=\"../pkg/Coin.html\" " +
-                "title=\"enum in pkg\">Coin</a>&gt;</pre>"
+            {BUG_ID + FS + "pkg" + FS + "Coin.html", "<pre>public enum " +
+                     "<span class=\"strong\">Coin</span>" + NL +
+                     "extends java.lang.Enum&lt;<a href=\"../pkg/Coin.html\" " +
+                     "title=\"enum in pkg\">Coin</a>&gt;</pre>"
             },
             //Check for enum constant section
             {BUG_ID + FS + "pkg" + FS + "Coin.html", "<caption><span>Enum Constants" +
@@ -118,8 +118,8 @@
 
             //Signature of subclass that has type parameters.
             {BUG_ID + FS + "pkg" + FS + "TypeParameterSubClass.html",
-                "<pre>public class <strong>TypeParameterSubClass&lt;T extends " +
-                "java.lang.String&gt;</strong>" + NL + "extends " +
+                "<pre>public class <span class=\"strong\">TypeParameterSubClass&lt;T extends " +
+                "java.lang.String&gt;</span>" + NL + "extends " +
                 "<a href=\"../pkg/TypeParameterSuperClass.html\" title=\"class in pkg\">" +
                 "TypeParameterSuperClass</a>&lt;T&gt;</pre>"},
 
@@ -168,7 +168,7 @@
                 "Annotation Type AnnotationType</h2>"},
             //Make sure the signature is correct.
             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
-                "public @interface <strong>AnnotationType</strong>"},
+                "public @interface <span class=\"strong\">AnnotationType</span>"},
             //Make sure member summary headings are correct.
             {BUG_ID + FS + "pkg" + FS + "AnnotationType.html",
                 "<h3>Required Element Summary</h3>"},
@@ -198,8 +198,8 @@
                 "<a href=\"../pkg/AnnotationType.html#optional()\">optional</a>" +
                 "=\"Class Annotation\"," + NL +
                 "                <a href=\"../pkg/AnnotationType.html#required()\">" +
-                "required</a>=1994)" + NL + "public class <strong>" +
-                "AnnotationTypeUsage</strong>" + NL + "extends java.lang.Object</pre>"},
+                "required</a>=1994)" + NL + "public class <span class=\"strong\">" +
+                "AnnotationTypeUsage</span>" + NL + "extends java.lang.Object</pre>"},
 
             //FIELD
             {BUG_ID + FS + "pkg" + FS + "AnnotationTypeUsage.html",
@@ -299,7 +299,7 @@
             {BUG_ID + FS + "pkg1" + FS + "B.html",
                 "<pre><a href=\"../pkg1/A.html\" title=\"annotation in pkg1\">@A</a>"},
             {BUG_ID + FS + "pkg1" + FS + "B.html",
-                "public interface <strong>B</strong></pre>"},
+                "public interface <span class=\"strong\">B</span></pre>"},
 
 
             //==============================================================
@@ -320,9 +320,11 @@
                      "Foo</a></span><span class=\"tabEnd\">&nbsp;</span></caption>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
-                     "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/" +
-                     "ClassUseTest1.html\" title=\"class in pkg2\">ClassUseTest1" +
-                     "&lt;T extends Foo & Foo2&gt;</a></strong></code>&nbsp;</td>"
+                     "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/ClassUseTest1.html\" " +
+                     "title=\"class in pkg2\">ClassUseTest1</a>&lt;T extends " +
+                     "<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo" +
+                     "</a> & <a href=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">" +
+                     "Foo2</a>&gt;</strong></code>&nbsp;</td>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo.html",
                      "<caption><span>Methods in <a href=\"../../pkg2/" +
@@ -370,10 +372,11 @@
                     "</span></caption>"
            },
            {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html",
-                    "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/" +
-                    "ClassUseTest1.html\" title=\"class in pkg2\">" +
-                    "ClassUseTest1&lt;T extends Foo & Foo2&gt;</a></strong>" +
-                    "</code>&nbsp;</td>"
+                    "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/ClassUseTest1.html\" " +
+                     "title=\"class in pkg2\">ClassUseTest1</a>&lt;T extends " +
+                     "<a href=\"../../pkg2/Foo.html\" title=\"class in pkg2\">Foo" +
+                     "</a> & <a href=\"../../pkg2/Foo2.html\" title=\"interface in pkg2\">" +
+                     "Foo2</a>&gt;</strong></code>&nbsp;</td>"
            },
            {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo2.html",
                     "<caption><span>Methods in <a href=\"../../pkg2/" +
@@ -398,10 +401,11 @@
                      "&nbsp;</span></caption>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
-                     "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/" +
-                     "ClassUseTest2.html\" title=\"class in pkg2\">ClassUseTest2&lt;T " +
-                     "extends ParamTest&lt;<a href=\"../../pkg2/Foo3.html\" title=\"class " +
-                     "in pkg2\">Foo3</a>&gt;&gt;</a></strong></code>&nbsp;</td>"
+                     "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/ClassUseTest2.html\" " +
+                     "title=\"class in pkg2\">ClassUseTest2</a>&lt;T extends " +
+                     "<a href=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">" +
+                     "ParamTest</a>&lt;<a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">" +
+                     "Foo3</a>&gt;&gt;</strong></code>&nbsp;</td>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest.html",
                      "<caption><span>Methods in <a href=\"../../pkg2/" +
@@ -452,11 +456,11 @@
                      "Foo3</a></span><span class=\"tabEnd\">&nbsp;</span></caption>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
-                     "<td class=\"colLast\"><code><strong><a href=\"../../" +
-                     "pkg2/ClassUseTest2.html\" title=\"class in pkg2\">" +
-                     "ClassUseTest2&lt;T extends ParamTest&lt;<a href=\"../../" +
-                     "pkg2/Foo3.html\" title=\"class in pkg2\">Foo3</a>&gt;&gt;" +
-                     "</a></strong></code>&nbsp;</td>"
+                     "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/ClassUseTest2.html\" " +
+                     "title=\"class in pkg2\">ClassUseTest2</a>&lt;T extends " +
+                     "<a href=\"../../pkg2/ParamTest.html\" title=\"class in pkg2\">" +
+                     "ParamTest</a>&lt;<a href=\"../../pkg2/Foo3.html\" title=\"class in pkg2\">" +
+                     "Foo3</a>&gt;&gt;</strong></code>&nbsp;</td>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo3.html",
                      "<caption><span>Methods in <a href=\"../../pkg2/" +
@@ -496,10 +500,12 @@
                      "&nbsp;</span></caption>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
-                     "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/" +
-                     "ClassUseTest3.html\" title=\"class in pkg2\">" +
-                     "ClassUseTest3&lt;T extends ParamTest2&lt;java.util.List" +
-                     "&lt;? extends Foo4&gt;&gt;&gt;</a></strong></code>&nbsp;</td>"
+                     "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/ClassUseTest3.html\" " +
+                     "title=\"class in pkg2\">ClassUseTest3</a>&lt;T extends " +
+                     "<a href=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">" +
+                     "ParamTest2</a>&lt;java.util.List&lt;? extends " +
+                     "<a href=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">" +
+                     "Foo4</a>&gt;&gt;&gt;</strong></code>&nbsp;</td>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "ParamTest2.html",
                      "<caption><span>Methods in <a href=\"../../pkg2/" +
@@ -532,10 +538,12 @@
                      "</span></caption>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
-                     "<td class=\"colLast\"><code><strong><a href=\"../../" +
-                     "pkg2/ClassUseTest3.html\" title=\"class in pkg2\">" +
-                     "ClassUseTest3&lt;T extends ParamTest2&lt;java.util.List" +
-                     "&lt;? extends Foo4&gt;&gt;&gt;</a></strong></code>&nbsp;</td>"
+                     "<td class=\"colLast\"><code><strong><a href=\"../../pkg2/ClassUseTest3.html\" " +
+                     "title=\"class in pkg2\">ClassUseTest3</a>&lt;T extends " +
+                     "<a href=\"../../pkg2/ParamTest2.html\" title=\"class in pkg2\">" +
+                     "ParamTest2</a>&lt;java.util.List&lt;? extends " +
+                     "<a href=\"../../pkg2/Foo4.html\" title=\"class in pkg2\">" +
+                     "Foo4</a>&gt;&gt;&gt;</strong></code>&nbsp;</td>"
             },
             {BUG_ID + FS + "pkg2" + FS + "class-use" + FS + "Foo4.html",
                      "<caption><span>Methods in <a href=\"../../pkg2/" +
--- a/langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java	Sun Apr 03 17:00:50 2011 -0700
+++ b/langtools/test/com/sun/javadoc/testTypeParams/TestTypeParameters.java	Mon Apr 04 10:14:23 2011 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2011, 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,55 +23,77 @@
 
 /*
  * @test
- * @bug      4927167 4974929
+ * @bug      4927167 4974929 7010344
  * @summary  When the type parameters are more than 10 characters in length,
  *           make sure there is a line break between type params and return type
- *           in member summary.
+ *           in member summary. Also, test for type parameter links in package-summary and
+ *           class-use pages. The class/annotation pages should check for type
+ *           parameter links in the class/annotation signature section when -linksource is set.
  * @author   jamieh
  * @library  ../lib/
- * @build    JavadocTester
- * @build    TestTypeParameters
+ * @build    JavadocTester TestTypeParameters
  * @run main TestTypeParameters
  */
 
 public class TestTypeParameters extends JavadocTester {
 
     //Test information.
-    private static final String BUG_ID = "4927167-4974929";
+    private static final String BUG_ID = "4927167-4974929-7010344";
 
     //Javadoc arguments.
-    private static final String[] ARGS = new String[] {
-        "-d", BUG_ID, "-source", "1.5", "-sourcepath", SRC_DIR,
-            "pkg"
+    private static final String[] ARGS1 = new String[]{
+        "-d", BUG_ID, "-use", "-source", "1.5", "-sourcepath", SRC_DIR,
+        "pkg"
+    };
+    private static final String[] ARGS2 = new String[]{
+        "-d", BUG_ID, "-linksource", "-source", "1.5", "-sourcepath", SRC_DIR,
+        "pkg"
     };
 
     //Input for string search tests.
-    private static final String[][] TEST =
-    {
+    private static final String[][] TEST1 = {
         {BUG_ID + FS + "pkg" + FS + "C.html",
             "<td class=\"colFirst\"><code>&lt;W extends java.lang.String,V extends " +
-            "java.util.List&gt;&nbsp;<br>java.lang.Object</code></td>"},
+            "java.util.List&gt;&nbsp;<br>java.lang.Object</code></td>"
+        },
         {BUG_ID + FS + "pkg" + FS + "C.html",
-            "<code>&lt;T&gt;&nbsp;java.lang.Object</code>"},
+            "<code>&lt;T&gt;&nbsp;java.lang.Object</code>"
+        },
         {BUG_ID + FS + "pkg" + FS + "package-summary.html",
-            "C&lt;E extends Parent&gt;"},
+            "C</a>&lt;E extends <a href=\"../pkg/Parent.html\" " +
+            "title=\"class in pkg\">Parent</a>&gt;"
+        },
+        {BUG_ID + FS + "pkg" + FS + "class-use" + FS + "Foo4.html",
+            "<a href=\"../../pkg/ClassUseTest3.html\" title=\"class in pkg\">" +
+            "ClassUseTest3</a>&lt;T extends <a href=\"../../pkg/ParamTest2.html\" " +
+            "title=\"class in pkg\">ParamTest2</a>&lt;java.util.List&lt;? extends " +
+            "<a href=\"../../pkg/Foo4.html\" title=\"class in pkg\">Foo4</a>&gt;&gt;&gt;"
+        },
         //Nested type parameters
         {BUG_ID + FS + "pkg" + FS + "C.html",
             "<a name=\"formatDetails(java.util.Collection, java.util.Collection)\">" + NL +
             "<!--   -->" + NL +
-            "</a>"},
-
+            "</a>"
+        },
+    };
+    private static final String[][] TEST2 = {
+        {BUG_ID + FS + "pkg" + FS + "ClassUseTest3.html",
+            "public class <a href=\"../src-html/pkg/ClassUseTest3.html#line.28\">" +
+            "ClassUseTest3</a>&lt;T extends <a href=\"../pkg/ParamTest2.html\" " +
+            "title=\"class in pkg\">ParamTest2</a>&lt;java.util.List&lt;? extends " +
+            "<a href=\"../pkg/Foo4.html\" title=\"class in pkg\">Foo4</a>&gt;&gt;&gt;"
+        }
     };
     private static final String[][] NEGATED_TEST = NO_TEST;
 
-
     /**
      * The entry point of the test.
      * @param args the array of command line arguments.
      */
     public static void main(String[] args) {
         TestTypeParameters tester = new TestTypeParameters();
-        run(tester, ARGS, TEST, NEGATED_TEST);
+        run(tester, ARGS1, TEST1, NEGATED_TEST);
+        run(tester, ARGS2, TEST2, NEGATED_TEST);
         tester.printSummary();
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testTypeParams/pkg/ClassUseTest3.java	Mon Apr 04 10:14:23 2011 -0700
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2011, 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
+ * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+import java.util.*;
+
+public class ClassUseTest3 <T extends ParamTest2<List<? extends Foo4>>> {
+
+    public ClassUseTest3(Set<Foo4> p) {}
+
+    public <T extends ParamTest2<List<? extends Foo4>>> ParamTest2<List<? extends Foo4>> method(T t) {
+        return null;
+    }
+
+    public void method(Set<Foo4> p) {}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testTypeParams/pkg/Foo4.java	Mon Apr 04 10:14:23 2011 -0700
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2011, 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
+ * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+public class Foo4 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/test/com/sun/javadoc/testTypeParams/pkg/ParamTest2.java	Mon Apr 04 10:14:23 2011 -0700
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2011, 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
+ * 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package pkg;
+
+public class ParamTest2<E> {
+}