changeset 23794:9437acfa99e9

8031625: javadoc problems referencing inner class constructors Reviewed-by: jjg
author bpatel
date Tue, 25 Mar 2014 22:07:55 -0700
parents 43528da4c974
children 62509b72088e
files langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java langtools/src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java langtools/test/com/sun/javadoc/testConstructors/TestConstructors.java langtools/test/com/sun/javadoc/testConstructors/pkg1/Outer.java
diffstat 4 files changed, 47 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue Mar 25 14:50:31 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Tue Mar 25 22:07:55 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -1443,7 +1443,8 @@
                 }
             }
             if (configuration.currentcd != containing) {
-                refMemName = containing.name() + "." + refMemName;
+                refMemName = (refMem instanceof ConstructorDoc) ?
+                        refMemName : containing.name() + "." + refMemName;
             }
             if (refMem instanceof ExecutableMemberDoc) {
                 if (refMemName.indexOf('(') < 0) {
--- a/langtools/src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java	Tue Mar 25 14:50:31 2014 -0700
+++ b/langtools/src/share/classes/com/sun/tools/javadoc/SeeTagImpl.java	Tue Mar 25 22:07:55 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -398,7 +398,8 @@
 
     private MemberDoc findExecutableMember(String memName, String[] paramarr,
                                            ClassDoc referencedClass) {
-        if (memName.equals(referencedClass.name())) {
+        String className = referencedClass.name();
+        if (memName.equals(className.substring(className.lastIndexOf(".") + 1))) {
             return ((ClassDocImpl)referencedClass).findConstructor(memName,
                                                                    paramarr);
         } else {   // it's a method.
--- a/langtools/test/com/sun/javadoc/testConstructors/TestConstructors.java	Tue Mar 25 14:50:31 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testConstructors/TestConstructors.java	Tue Mar 25 22:07:55 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, 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 8025524
+ * @bug 8025524 8031625
  * @summary Test for constructor name which should be a non-qualified name.
  * @author Bhavesh Patel
  * @library ../lib/
@@ -38,6 +38,21 @@
     //Input for string search tests.
     private static final String[][] TEST = {
         {BUG_ID + FS + "pkg1" + FS + "Outer.html",
+            "<dt><span class=\"seeLabel\">See Also:</span></dt>" + NL +
+            "<dd><a href=\"../pkg1/Outer.Inner.html#Inner--\"><code>Inner()</code></a>, " + NL +
+            "<a href=\"../pkg1/Outer.Inner.html#Inner-int-\"><code>Inner(int)</code></a>, " + NL +
+            "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner--\"><code>NestedInner()</code></a>, " + NL +
+            "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\"><code>NestedInner(int)</code></a>, " + NL +
+            "<a href=\"../pkg1/Outer.html#Outer--\"><code>Outer()</code></a>, " + NL +
+            "<a href=\"../pkg1/Outer.html#Outer-int-\"><code>Outer(int)</code></a>"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "Outer.html",
+            "Link: <a href=\"../pkg1/Outer.Inner.html#Inner--\"><code>Inner()</code></a>, " +
+            "<a href=\"../pkg1/Outer.html#Outer-int-\"><code>Outer(int)</code></a>, " +
+            "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\"><code>" +
+            "NestedInner(int)</code></a>"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "Outer.html",
             "<a href=\"../pkg1/Outer.html#Outer--\">Outer</a></span>()"
         },
         {BUG_ID + FS + "pkg1" + FS + "Outer.html",
@@ -87,6 +102,18 @@
         },
         {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.NestedInner.html",
             "Outer.Inner.NestedInner-int-"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "Outer.html",
+            "<a href=\"../pkg1/Outer.Inner.html#Outer.Inner--\"><code>Outer.Inner()</code></a>"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "Outer.html",
+            "<a href=\"../pkg1/Outer.Inner.html#Outer.Inner-int-\"><code>Outer.Inner(int)</code></a>"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "Outer.html",
+            "<a href=\"../pkg1/Outer.Inner.NestedInner.html#Outer.Inner.NestedInner--\"><code>Outer.Inner.NestedInner()</code></a>"
+        },
+        {BUG_ID + FS + "pkg1" + FS + "Outer.html",
+            "<a href=\"../pkg1/Outer.Inner.NestedInner.html#Outer.Inner.NestedInner-int-\"><code>Outer.Inner.NestedInner(int)</code></a>"
         }
     };
 
--- a/langtools/test/com/sun/javadoc/testConstructors/pkg1/Outer.java	Tue Mar 25 14:50:31 2014 -0700
+++ b/langtools/test/com/sun/javadoc/testConstructors/pkg1/Outer.java	Tue Mar 25 22:07:55 2014 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, 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,6 +23,17 @@
 
 package pkg1;
 
+/**
+ * Test link tag.
+ * Link: {@link pkg1.Outer.Inner#Inner()}, {@link pkg1.Outer#Outer(int)}, {@link pkg1.Outer.Inner.NestedInner#NestedInner(int)}
+ *
+ * @see Outer.Inner#Inner()
+ * @see Outer.Inner#Inner(int)
+ * @see Outer.Inner.NestedInner#NestedInner()
+ * @see Outer.Inner.NestedInner#NestedInner(int)
+ * @see Outer#Outer()
+ * @see Outer#Outer(int)
+ */
 public class Outer {
 
     /**