This commit is contained in:
Lana Steuck 2014-10-03 12:11:32 -07:00
commit 97f636e1e0
20 changed files with 62 additions and 224 deletions

View File

@ -333,7 +333,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
HtmlTree ul = new HtmlTree(HtmlTag.UL);
ul.addStyle(HtmlStyle.blockList);
for (PackageDoc pkg : pkgSet) {
Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(pkg.name()));
Content li = HtmlTree.LI(HtmlStyle.blockList, getMarkerAnchor(getPackageAnchorName(pkg)));
Content link = getResource("doclet.ClassUse_Uses.of.0.in.1",
getLink(new LinkInfoImpl(configuration, LinkInfoImpl.Kind.CLASS_USE_HEADER,
classdoc)),
@ -355,7 +355,7 @@ public class ClassUseWriter extends SubWriterHolderWriter {
*/
protected void addPackageUse(PackageDoc pkg, Content contentTree) throws IOException {
Content tdFirst = HtmlTree.TD(HtmlStyle.colFirst,
getHyperLink(pkg.name(), new StringContent(utils.getPackageName(pkg))));
getHyperLink(getPackageAnchorName(pkg), new StringContent(utils.getPackageName(pkg))));
contentTree.addContent(tdFirst);
HtmlTree tdLast = new HtmlTree(HtmlTag.TD);
tdLast.addStyle(HtmlStyle.colLast);

View File

@ -991,6 +991,16 @@ public class HtmlDocletWriter extends HtmlDocWriter {
return pathToRoot.resolve(DocPath.forPackage(pd).resolve(name));
}
/**
* Given a package, return the name to be used in HTML anchor tag.
* @param packageDoc the package.
* @return the name to be used in HTML anchor tag.
*/
public String getPackageAnchorName(PackageDoc packageDoc) {
return packageDoc == null || packageDoc.name().length() == 0 ?
SectionName.UNNAMED_PACKAGE_ANCHOR.getName() : packageDoc.name();
}
/**
* Return the link to the given package.
*

View File

@ -207,7 +207,7 @@ public class PackageUseWriter extends SubWriterHolderWriter {
} else {
tr.addStyle(HtmlStyle.rowColor);
}
addClassRow(itc.next(), packageName, tr);
addClassRow(itc.next(), usingPackage, tr);
tbody.addContent(tr);
}
table.addContent(tbody);
@ -220,15 +220,15 @@ public class PackageUseWriter extends SubWriterHolderWriter {
* Add a row for the class that uses the given package.
*
* @param usedClass the class that uses the given package
* @param packageName the name of the package to which the class belongs
* @param pkg the package to which the class belongs
* @param contentTree the content tree to which the row will be added
*/
protected void addClassRow(ClassDoc usedClass, String packageName,
protected void addClassRow(ClassDoc usedClass, PackageDoc pkg,
Content contentTree) {
DocPath dp = pathString(usedClass,
DocPaths.CLASS_USE.resolve(DocPath.forName(usedClass)));
Content td = HtmlTree.TD(HtmlStyle.colOne,
getHyperLink(dp.fragment(packageName), new StringContent(usedClass.name())));
getHyperLink(dp.fragment(getPackageAnchorName(pkg)), new StringContent(usedClass.name())));
addIndexComment(usedClass, td);
contentTree.addContent(td);
}

View File

@ -23,7 +23,7 @@
/*
* @test
* @bug 6492694 8026567
* @bug 6492694 8026567 8048351
* @summary Test package deprecation.
* @author bpatel
* @library ../lib/
@ -70,6 +70,8 @@ public class TestPackageDeprecation extends JavadocTester {
"pkg1");
checkOutput("allclasses-frame.html", false,
"FooDepr");
checkOutput("class-use/C2.ModalExclusionType.html", true,
"<td class=\"colFirst\"><a href=\"#unnamed.package\">&lt;Unnamed&gt;</a></td>");
checkFiles(false,
"pkg1/package-summary.html",

View File

@ -23,7 +23,7 @@
/*
* @test
* @bug 4496290 4985072 7006178 7068595 8016328 8050031
* @bug 4496290 4985072 7006178 7068595 8016328 8050031 8048351
* @summary A simple test to ensure class-use files are correct.
* @author jamieh
* @library ../lib
@ -134,9 +134,12 @@ public class TestUseOption extends JavadocTester {
"Uses of <a href=\"../UsedInC.html\" title=\"class in &lt;Unnamed&gt;\">"
+ "UsedInC</a> in <a href=\"../package-summary.html\">&lt;Unnamed&gt;</a>"
);
checkOutput("class-use/UsedInC.html", true,
"<li class=\"blockList\"><a name=\"unnamed.package\">"
);
checkOutput("package-use.html", true,
"<td class=\"colOne\">"
+ "<a href=\"class-use/UsedInC.html#%3CUnnamed%3E\">UsedInC</a>&nbsp;</td>"
+ "<a href=\"class-use/UsedInC.html#unnamed.package\">UsedInC</a>&nbsp;</td>"
);
}

View File

@ -1,32 +1,9 @@
/*
* Copyright (c) 2006, 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.
*/
/*
* @test
* @test /nodynamiccopyright/
* @bug 6306967
* @summary Variable x is used before initialized
* @author Wei Tao
* @compile/fail T6306967.java
* @compile/fail/ref=T6306967.out -XDrawDiagnostics T6306967.java
*/
public class T6306967 {

View File

@ -0,0 +1,2 @@
T6306967.java:18:28: compiler.err.var.might.not.have.been.initialized: x
1 error

View File

@ -1,32 +1,9 @@
/*
* Copyright (c) 2006, 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.
*/
/*
* @test
* @test /nodynamiccopyright/
* @bug 6379327
* @summary Erroneous catch block not detected with anonymous class declaration
* @author Peter Jones, Wei Tao
* @compile/fail T6379327.java
* @compile/fail/ref=T6379327.out -XDrawDiagnostics T6379327.java
*/
import java.security.*;

View File

@ -0,0 +1,2 @@
T6379327.java:19:11: compiler.err.except.never.thrown.in.try: java.lang.ClassNotFoundException
1 error

View File

@ -1,32 +1,9 @@
/*
* Copyright (c) 2006, 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.
*/
/*
* @test
* @test /nodynamiccopyright/
* @bug 6407257
* @summary javac locks up when encountering cyclic inheritance
* @author Peter von der Ah\u00e9
* @compile/fail T6407257.java
* @compile/fail/ref=T6407257.out -XDrawDiagnostics T6407257.java
*/
class T6407257a extends T6407257a {}

View File

@ -0,0 +1,2 @@
T6407257.java:9:1: compiler.err.cyclic.inheritance: T6407257a
1 error

View File

@ -1,32 +1,9 @@
/*
* Copyright (c) 2008, 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.
*/
/*
* @test
* @test /nodynamiccopyright/
* @bug 6663588
* @summary Compiler goes into infinite loop for Cyclic Inheritance test case
* @author Maurizio Cimadamore
* @compile/fail T6663588.java
* @compile/fail/ref=T6663588.out -XDrawDiagnostics T6663588.java
*/
public class T6663588<T extends T6663588.Inner> extends T6663588 {

View File

@ -0,0 +1,2 @@
T6663588.java:9:8: compiler.err.cyclic.inheritance: T6663588
1 error

View File

@ -1,36 +1,14 @@
/*
* Copyright (c) 1997, 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.
*/
/*
* @test
* @bug 4035346
* @test /nodynamiccopyright/
* @bug 4035346 4097402
* @summary Compiler used to allow this initialization, despite the overflow.
* @author turnidge
*
* @compile/fail UncaughtOverflow.java
* @compile/fail/ref=UncaughtOverflow.out -XDrawDiagnostics UncaughtOverflow.java
*/
public
class UncaughtOverflow {
int i = 100000000000;
int i1 = 100000000000;
int i2 = -2147483649;
}

View File

@ -0,0 +1,3 @@
UncaughtOverflow.java:12:14: compiler.err.int.number.too.large: 100000000000
UncaughtOverflow.java:13:15: compiler.err.int.number.too.large: -2147483649
2 errors

View File

@ -1,36 +0,0 @@
/*
* Copyright (c) 1998, 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.
*/
/*
* @test
* @bug 4097402
* @summary Compiler used to allow this initialization, despite the overflow.
* @author turnidge
*
* @compile/fail UncaughtOverflow2.java
*/
public
class UncaughtOverflow2 {
int i = -2147483649;
}

View File

@ -1,40 +1,16 @@
/*
* Copyright (c) 2004, 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.
*/
/**
* @test
* @test /nodynamiccopyright/
* @bug 5013488
* @summary Compiler AssertionError: com.sun.tools.javac.util.Bits.incl(Bits.java:73)
*
* @compile/fail UseEnum.java
* @compile/fail/ref=UseEnum.out -XDrawDiagnostics UseEnum.java
*/
import static java.lang.System.out;
class UseEnum {
enum Animal {cat, dog, bird, fish};
public static void main(String args[]) {
enum Animal {cat, dog, bird, fish};
Animal pet;
pet = Animal.cat;

View File

@ -0,0 +1,2 @@
UseEnum.java:19:29: compiler.err.cant.resolve.location: kindname.variable, beast, , , (compiler.misc.location: kindname.class, UseEnum, null)
1 error

View File

@ -1,33 +1,10 @@
/*
* Copyright (c) 1997, 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.
*/
/*
* @test
* @test /nodynamiccopyright/
* @bug 4034979
* @summary The compiler should never allow void[] to appear as a type
* in a program.
*
* @compile/fail VoidArray.java
* @compile/fail/ref=VoidArray.out -XDrawDiagnostics VoidArray.java
*/
public

View File

@ -0,0 +1,7 @@
VoidArray.java:12:9: compiler.err.expected: token.identifier
VoidArray.java:12:13: compiler.err.expected: token.identifier
VoidArray.java:14:9: compiler.err.expected: token.identifier
VoidArray.java:14:12: compiler.err.invalid.meth.decl.ret.type.req
VoidArray.java:14:24: compiler.err.expected: token.identifier
VoidArray.java:14:28: compiler.err.expected3: ',', ')', '['
6 errors