changeset 2653:e18407fcede8 jdk9-b34

Merge
author lana
date Fri, 03 Oct 2014 12:11:32 -0700
parents 49d692597e7b ed691a10b8fc
children 7193d3fefda6 00b00232dab6
files test/tools/javac/UncaughtOverflow2.java
diffstat 20 files changed, 62 insertions(+), 224 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Fri Oct 03 11:07:15 2014 -0700
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/ClassUseWriter.java	Fri Oct 03 12:11:32 2014 -0700
@@ -333,7 +333,7 @@
         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 @@
      */
     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);
--- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Fri Oct 03 11:07:15 2014 -0700
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/HtmlDocletWriter.java	Fri Oct 03 12:11:32 2014 -0700
@@ -992,6 +992,16 @@
     }
 
     /**
+     * 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.
      *
      * @param pkg the package to link to.
--- a/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java	Fri Oct 03 11:07:15 2014 -0700
+++ b/src/jdk.javadoc/share/classes/com/sun/tools/doclets/formats/html/PackageUseWriter.java	Fri Oct 03 12:11:32 2014 -0700
@@ -207,7 +207,7 @@
                 } 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 @@
      * 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);
     }
--- a/test/com/sun/javadoc/testPackageDeprecation/TestPackageDeprecation.java	Fri Oct 03 11:07:15 2014 -0700
+++ b/test/com/sun/javadoc/testPackageDeprecation/TestPackageDeprecation.java	Fri Oct 03 12:11:32 2014 -0700
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug      6492694 8026567
+ * @bug      6492694 8026567 8048351
  * @summary  Test package deprecation.
  * @author   bpatel
  * @library  ../lib/
@@ -70,6 +70,8 @@
                 "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",
--- a/test/com/sun/javadoc/testUseOption/TestUseOption.java	Fri Oct 03 11:07:15 2014 -0700
+++ b/test/com/sun/javadoc/testUseOption/TestUseOption.java	Fri Oct 03 12:11:32 2014 -0700
@@ -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 @@
                 "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>"
         );
     }
 
--- a/test/tools/javac/T6306967.java	Fri Oct 03 11:07:15 2014 -0700
+++ b/test/tools/javac/T6306967.java	Fri Oct 03 12:11:32 2014 -0700
@@ -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 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T6306967.out	Fri Oct 03 12:11:32 2014 -0700
@@ -0,0 +1,2 @@
+T6306967.java:18:28: compiler.err.var.might.not.have.been.initialized: x
+1 error
--- a/test/tools/javac/T6379327.java	Fri Oct 03 11:07:15 2014 -0700
+++ b/test/tools/javac/T6379327.java	Fri Oct 03 12:11:32 2014 -0700
@@ -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.*;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T6379327.out	Fri Oct 03 12:11:32 2014 -0700
@@ -0,0 +1,2 @@
+T6379327.java:19:11: compiler.err.except.never.thrown.in.try: java.lang.ClassNotFoundException
+1 error
--- a/test/tools/javac/T6407257.java	Fri Oct 03 11:07:15 2014 -0700
+++ b/test/tools/javac/T6407257.java	Fri Oct 03 12:11:32 2014 -0700
@@ -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 {}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T6407257.out	Fri Oct 03 12:11:32 2014 -0700
@@ -0,0 +1,2 @@
+T6407257.java:9:1: compiler.err.cyclic.inheritance: T6407257a
+1 error
--- a/test/tools/javac/T6663588.java	Fri Oct 03 11:07:15 2014 -0700
+++ b/test/tools/javac/T6663588.java	Fri Oct 03 12:11:32 2014 -0700
@@ -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 {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T6663588.out	Fri Oct 03 12:11:32 2014 -0700
@@ -0,0 +1,2 @@
+T6663588.java:9:8: compiler.err.cyclic.inheritance: T6663588
+1 error
--- a/test/tools/javac/UncaughtOverflow.java	Fri Oct 03 11:07:15 2014 -0700
+++ b/test/tools/javac/UncaughtOverflow.java	Fri Oct 03 12:11:32 2014 -0700
@@ -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;
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/UncaughtOverflow.out	Fri Oct 03 12:11:32 2014 -0700
@@ -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
--- a/test/tools/javac/UncaughtOverflow2.java	Fri Oct 03 11:07:15 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -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;
-}
--- a/test/tools/javac/UseEnum.java	Fri Oct 03 11:07:15 2014 -0700
+++ b/test/tools/javac/UseEnum.java	Fri Oct 03 12:11:32 2014 -0700
@@ -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;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/UseEnum.out	Fri Oct 03 12:11:32 2014 -0700
@@ -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
--- a/test/tools/javac/VoidArray.java	Fri Oct 03 11:07:15 2014 -0700
+++ b/test/tools/javac/VoidArray.java	Fri Oct 03 12:11:32 2014 -0700
@@ -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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/VoidArray.out	Fri Oct 03 12:11:32 2014 -0700
@@ -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