Thu, 14 Nov 2013 13:47:38 -0800
8025524: javadoc does not correctly locate constructors for nested classes
Reviewed-by: jjg
1.1 --- a/src/share/classes/com/sun/tools/javadoc/ConstructorDocImpl.java Thu Nov 14 19:28:20 2013 +0000 1.2 +++ b/src/share/classes/com/sun/tools/javadoc/ConstructorDocImpl.java Thu Nov 14 13:47:38 2013 -0800 1.3 @@ -73,15 +73,11 @@ 1.4 /** 1.5 * Get the name. 1.6 * 1.7 - * @return the name of the member qualified by class (but not package) 1.8 + * @return the name of the member. 1.9 */ 1.10 public String name() { 1.11 ClassSymbol c = sym.enclClass(); 1.12 - String n = c.name.toString(); 1.13 - for (c = c.owner.enclClass(); c != null; c = c.owner.enclClass()) { 1.14 - n = c.name.toString() + "." + n; 1.15 - } 1.16 - return n; 1.17 + return c.name.toString(); 1.18 } 1.19 1.20 /**
2.1 --- a/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java Thu Nov 14 19:28:20 2013 +0000 2.2 +++ b/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java Thu Nov 14 13:47:38 2013 -0800 2.3 @@ -23,7 +23,7 @@ 2.4 2.5 /* 2.6 * @test 2.7 - * @bug 8025633 2.8 + * @bug 8025633 8025524 2.9 * @summary Test for valid name attribute in HTML anchors. 2.10 * @author Bhavesh Patel 2.11 * @library ../lib/ 2.12 @@ -196,10 +196,10 @@ 2.13 //Test nested class 2.14 2.15 {BUG_ID + FS + "pkg1" + FS + "RegClass._NestedClas$.html", 2.16 - "<a name=\"RegClass._NestedClas:D--\">" 2.17 + "<a name=\"Z:Z_NestedClas:D--\">" 2.18 }, 2.19 {BUG_ID + FS + "pkg1" + FS + "RegClass._NestedClas$.html", 2.20 - "<a href=\"../pkg1/RegClass._NestedClas$.html#RegClass._NestedClas:D--\">" 2.21 + "<a href=\"../pkg1/RegClass._NestedClas$.html#Z:Z_NestedClas:D--\">" 2.22 }, 2.23 2.24 //Test class use page
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/test/com/sun/javadoc/testConstructors/TestConstructors.java Thu Nov 14 13:47:38 2013 -0800 3.3 @@ -0,0 +1,120 @@ 3.4 +/* 3.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.7 + * 3.8 + * This code is free software; you can redistribute it and/or modify it 3.9 + * under the terms of the GNU General Public License version 2 only, as 3.10 + * published by the Free Software Foundation. 3.11 + * 3.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 3.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 3.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 3.15 + * version 2 for more details (a copy is included in the LICENSE file that 3.16 + * accompanied this code). 3.17 + * 3.18 + * You should have received a copy of the GNU General Public License version 3.19 + * 2 along with this work; if not, write to the Free Software Foundation, 3.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 3.21 + * 3.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 3.23 + * or visit www.oracle.com if you need additional information or have any 3.24 + * questions. 3.25 + */ 3.26 + 3.27 +/* 3.28 + * @test 3.29 + * @bug 8025524 3.30 + * @summary Test for constructor name which should be a non-qualified name. 3.31 + * @author Bhavesh Patel 3.32 + * @library ../lib/ 3.33 + * @build JavadocTester TestConstructors 3.34 + * @run main TestConstructors 3.35 + */ 3.36 + 3.37 +public class TestConstructors extends JavadocTester { 3.38 + 3.39 + private static final String BUG_ID = "8025524"; 3.40 + 3.41 + //Input for string search tests. 3.42 + private static final String[][] TEST = { 3.43 + {BUG_ID + FS + "pkg1" + FS + "Outer.html", 3.44 + "<a href=\"../pkg1/Outer.html#Outer--\">Outer</a></span>()" 3.45 + }, 3.46 + {BUG_ID + FS + "pkg1" + FS + "Outer.html", 3.47 + "<a name=\"Outer--\">" 3.48 + }, 3.49 + {BUG_ID + FS + "pkg1" + FS + "Outer.html", 3.50 + "<a href=\"../pkg1/Outer.html#Outer-int-\">Outer</a></span>(int i)" 3.51 + }, 3.52 + {BUG_ID + FS + "pkg1" + FS + "Outer.html", 3.53 + "<a name=\"Outer-int-\">" 3.54 + }, 3.55 + {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.html", 3.56 + "<a href=\"../pkg1/Outer.Inner.html#Inner--\">Inner</a></span>()" 3.57 + }, 3.58 + {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.html", 3.59 + "<a name=\"Inner--\">" 3.60 + }, 3.61 + {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.html", 3.62 + "<a href=\"../pkg1/Outer.Inner.html#Inner-int-\">Inner</a></span>(int i)" 3.63 + }, 3.64 + {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.html", 3.65 + "<a name=\"Inner-int-\">" 3.66 + }, 3.67 + {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.NestedInner.html", 3.68 + "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner--\">NestedInner</a></span>()" 3.69 + }, 3.70 + {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.NestedInner.html", 3.71 + "<a name=\"NestedInner--\">" 3.72 + }, 3.73 + {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.NestedInner.html", 3.74 + "<a href=\"../pkg1/Outer.Inner.NestedInner.html#NestedInner-int-\">NestedInner</a></span>(int i)" 3.75 + }, 3.76 + {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.NestedInner.html", 3.77 + "<a name=\"NestedInner-int-\">" 3.78 + } 3.79 + }; 3.80 + 3.81 + private static final String[][] NEGATED_TEST = { 3.82 + {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.html", 3.83 + "Outer.Inner--" 3.84 + }, 3.85 + {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.html", 3.86 + "Outer.Inner-int-" 3.87 + }, 3.88 + {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.NestedInner.html", 3.89 + "Outer.Inner.NestedInner--" 3.90 + }, 3.91 + {BUG_ID + FS + "pkg1" + FS + "Outer.Inner.NestedInner.html", 3.92 + "Outer.Inner.NestedInner-int-" 3.93 + } 3.94 + }; 3.95 + 3.96 + private static final String[] ARGS = new String[] { 3.97 + "-d", BUG_ID, "-sourcepath", SRC_DIR, "pkg1" 3.98 + }; 3.99 + 3.100 + /** 3.101 + * The entry point of the test. 3.102 + * @param args the array of command line arguments. 3.103 + */ 3.104 + public static void main(String[] args) throws Exception { 3.105 + TestConstructors tester = new TestConstructors(); 3.106 + run(tester, ARGS, TEST, NEGATED_TEST); 3.107 + tester.printSummary(); 3.108 + } 3.109 + 3.110 + /** 3.111 + * {@inheritDoc} 3.112 + */ 3.113 + public String getBugId() { 3.114 + return BUG_ID; 3.115 + } 3.116 + 3.117 + /** 3.118 + * {@inheritDoc} 3.119 + */ 3.120 + public String getBugName() { 3.121 + return getClass().getName(); 3.122 + } 3.123 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/test/com/sun/javadoc/testConstructors/pkg1/Outer.java Thu Nov 14 13:47:38 2013 -0800 4.3 @@ -0,0 +1,75 @@ 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. 4.11 + * 4.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 4.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4.15 + * version 2 for more details (a copy is included in the LICENSE file that 4.16 + * accompanied this code). 4.17 + * 4.18 + * You should have received a copy of the GNU General Public License version 4.19 + * 2 along with this work; if not, write to the Free Software Foundation, 4.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4.21 + * 4.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4.23 + * or visit www.oracle.com if you need additional information or have any 4.24 + * questions. 4.25 + */ 4.26 + 4.27 +package pkg1; 4.28 + 4.29 +public class Outer { 4.30 + 4.31 + /** 4.32 + * An outer constructor. 4.33 + */ 4.34 + public Outer() { 4.35 + } 4.36 + 4.37 + /** 4.38 + * Another outer constructor. 4.39 + */ 4.40 + public Outer(int i) { 4.41 + } 4.42 + 4.43 + /** 4.44 + * A nested class. 4.45 + */ 4.46 + public class Inner { 4.47 + 4.48 + /** 4.49 + * An inner constructor. 4.50 + */ 4.51 + public Inner() { 4.52 + } 4.53 + 4.54 + /** 4.55 + * Another inner constructor. 4.56 + */ 4.57 + public Inner(int i) { 4.58 + } 4.59 + 4.60 + /** 4.61 + * A nested inner class. 4.62 + */ 4.63 + public class NestedInner { 4.64 + 4.65 + /** 4.66 + * A nested inner constructor. 4.67 + */ 4.68 + public NestedInner() { 4.69 + } 4.70 + 4.71 + /** 4.72 + * Another nested inner constructor. 4.73 + */ 4.74 + public NestedInner(int i) { 4.75 + } 4.76 + } 4.77 + } 4.78 +}
5.1 --- a/test/tools/javadoc/generics/genericInnerAndOuter/expected.out Thu Nov 14 19:28:20 2013 +0000 5.2 +++ b/test/tools/javadoc/generics/genericInnerAndOuter/expected.out Thu Nov 14 13:47:38 2013 -0800 5.3 @@ -16,7 +16,7 @@ 5.4 superclass: 5.5 java.lang.Object 5.6 constructors: 5.7 - O.I() 5.8 + I() 5.9 methods: 5.10 void m1(O<String>.I<Number>) 5.11 5.12 @@ -36,7 +36,7 @@ 5.13 superclass: 5.14 java.lang.Object 5.15 constructors: 5.16 - X.Y() 5.17 + Y() 5.18 5.19 class pkg1.X<T>.Y.Z<S> 5.20 name: Z / X.Y.Z / pkg1.X.Y.Z 5.21 @@ -47,7 +47,7 @@ 5.22 superclass: 5.23 java.lang.Object 5.24 constructors: 5.25 - X.Y.Z() 5.26 + Z() 5.27 methods: 5.28 void m1(X<String>.Y.Z<Number>) 5.29