changeset 2817:1ccb6ef2f40b jdk9-b50

Merge
author lana
date Thu, 05 Feb 2015 15:44:57 -0800
parents ffbb7994cc0b (current diff) 4925358d11e6 (diff)
children 9c1c3351aa64 b93a15ac3bde
files
diffstat 10 files changed, 154 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/make/tools/propertiesparser/gen/ClassGenerator.java	Thu Feb 05 11:43:37 2015 -0800
+++ b/make/tools/propertiesparser/gen/ClassGenerator.java	Thu Feb 05 15:44:57 2015 -0800
@@ -192,8 +192,8 @@
      */
     String packageName(File file) {
         String path = file.getAbsolutePath();
-        int begin = path.indexOf("com" + File.separatorChar);
-        String packagePath = path.substring(begin, path.lastIndexOf(File.separatorChar));
+        int begin = path.lastIndexOf(File.separatorChar + "com" + File.separatorChar);
+        String packagePath = path.substring(begin + 1, path.lastIndexOf(File.separatorChar));
         String packageName =  packagePath.replace(File.separatorChar, '.');
         return packageName;
     }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Thu Feb 05 11:43:37 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Types.java	Thu Feb 05 15:44:57 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2015, 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
@@ -1931,6 +1931,11 @@
      * Return the (most specific) base type of t that starts with the
      * given symbol.  If none exists, return null.
      *
+     * Caveat Emptor: Since javac represents the class of all arrays with a singleton
+     * symbol Symtab.arrayClass, which by being a singleton cannot hold any discriminant,
+     * this method could yield surprising answers when invoked on arrays. For example when
+     * invoked with t being byte [] and sym being t.sym itself, asSuper would answer null.
+     *
      * @param t a type
      * @param sym a symbol
      */
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java	Thu Feb 05 11:43:37 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TransTypes.java	Thu Feb 05 15:44:57 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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
@@ -720,7 +720,7 @@
 
     public void visitParens(JCParens tree) {
         tree.expr = translate(tree.expr, pt);
-        tree.type = erasure(tree.type);
+        tree.type = erasure(tree.expr.type);
         result = tree;
     }
 
@@ -755,7 +755,7 @@
         tree.clazz = translate(tree.clazz, null);
         Type originalTarget = tree.type;
         tree.type = erasure(tree.type);
-        JCExpression newExpression = translate(tree.expr, erasure(tree.expr.type));
+        JCExpression newExpression = translate(tree.expr, tree.type);
         if (newExpression != tree.expr) {
             JCTypeCast typeCast = newExpression.hasTag(Tag.TYPECAST)
                 ? (JCTypeCast) newExpression
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Feb 05 11:43:37 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Feb 05 15:44:57 2015 -0800
@@ -2145,7 +2145,8 @@
         // For basic types, the coerce(...) in genExpr(...) will do
         // the conversion.
         if (!tree.clazz.type.isPrimitive() &&
-            types.asSuper(tree.expr.type, tree.clazz.type.tsym) == null) {
+           !types.isSameType(tree.expr.type, tree.clazz.type) &&
+           types.asSuper(tree.expr.type, tree.clazz.type.tsym) == null) {
             code.emitop2(checkcast, makeRef(tree.pos(), tree.clazz.type));
         }
     }
--- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/ct.properties	Thu Feb 05 11:43:37 2015 -0800
+++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/ct.properties	Thu Feb 05 15:44:57 2015 -0800
@@ -477,7 +477,7 @@
 java.rmi.registry.*: compact2
 java.rmi.server.*: compact2
 java.security.*: compact1
-java.security.acl.*: compact3
+java.security.acl.*: compact1
 java.security.cert.*: compact1
 java.security.interfaces.*: compact1
 java.security.spec.*: compact1
@@ -687,7 +687,7 @@
 sun.rmi.transport.*: proprietary compact2
 sun.rmi.transport.proxy.*: proprietary compact2
 sun.rmi.transport.tcp.*: proprietary compact2
-sun.security.acl.*: proprietary compact3
+sun.security.acl.*: proprietary compact1
 sun.security.action.*: proprietary compact1
 sun.security.jca.*: proprietary compact1
 sun.security.jgss.*: proprietary compact3
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/CheckNoClassCastException.java	Thu Feb 05 15:44:57 2015 -0800
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2015, 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 8069265
+ * @summary ClassCastException when compiled with JDK 9b08+, JDK8 compiles OK.
+ * @run main CheckNoClassCastException
+ */
+import java.util.*;
+
+public class CheckNoClassCastException {
+    static String result = "";
+    public static void main(String[] args) {
+        ListFail.main(null);
+        MapFail.main(null);
+        if (!result.equals("ListFailDoneMapFailDone"))
+            throw new AssertionError("Incorrect result");
+    }
+}
+
+class ListFail {
+    static interface Foo {
+    }
+
+    public static void main(String[] args) {
+        List<Date> list = new ArrayList<>();
+        list.add(new Date());
+
+        List<Foo> cList = (List<Foo>) (List<?>) list;
+        Date date = (Date) cList.get(0);
+        CheckNoClassCastException.result += "ListFailDone";
+    }
+}
+
+
+class MapFail {
+    static interface Foo {
+    }
+
+    public static void main(String[] args) {
+        Map<String,Date> aMap = new HashMap<>();
+        aMap.put("test",new Date());
+
+        Map<String,Foo> m = (Map<String,Foo>) (Map<?,?>) aMap;
+        Date q = (Date) m.get("test");
+        CheckNoClassCastException.result += "MapFailDone";
+    }
+}
--- a/test/tools/javac/T7053059/DoubleCastTest.java	Thu Feb 05 11:43:37 2015 -0800
+++ b/test/tools/javac/T7053059/DoubleCastTest.java	Thu Feb 05 15:44:57 2015 -0800
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2015, 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
@@ -47,6 +47,7 @@
             m1((byte[])m());
             m1((byte[])os[0]);
             m1((byte[])this.x);
+            m1((byte[])((byte []) (o = null)));
         }
     }
 
--- a/test/tools/javac/lambda/MethodReference55.java	Thu Feb 05 11:43:37 2015 -0800
+++ b/test/tools/javac/lambda/MethodReference55.java	Thu Feb 05 15:44:57 2015 -0800
@@ -1,29 +1,6 @@
 /*
- * Copyright (c) 2012, 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 8004101
+ * @test /nodynamiccopyright/
+ * @bug 8004101 8072445
  * @summary Add checks for method reference well-formedness
  * @compile/fail/ref=MethodReference55.out -XDrawDiagnostics MethodReference55.java
  */
--- a/test/tools/javac/lambda/MethodReference55.out	Thu Feb 05 11:43:37 2015 -0800
+++ b/test/tools/javac/lambda/MethodReference55.out	Thu Feb 05 15:44:57 2015 -0800
@@ -1,3 +1,3 @@
-MethodReference55.java:36:11: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.static.method.in.bound.lookup: kindname.method, m(java.lang.Object)))
-MethodReference55.java:39:9: compiler.err.cant.apply.symbol: kindname.method, g, MethodReference55.V, @1384, kindname.class, MethodReference55<X>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.static.method.in.bound.lookup: kindname.method, m(java.lang.Object))))
+MethodReference55.java:13:11: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.static.method.in.bound.lookup: kindname.method, m(java.lang.Object)))
+MethodReference55.java:16:9: compiler.err.cant.apply.symbol: kindname.method, g, MethodReference55.V, @361, kindname.class, MethodReference55<X>, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.bad.static.method.in.bound.lookup: kindname.method, m(java.lang.Object))))
 2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/sjavac/ParallelCompilations.java	Thu Feb 05 15:44:57 2015 -0800
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2015, 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.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * 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
+ * @summary Test to check that -j option works with more than one value
+ * @bug 8071629
+ * @author sogoel
+ * @library /tools/lib
+ * @build Wrapper ToolBox
+ * @run main Wrapper ParallelCompilations
+ */
+
+import java.io.*;
+import java.nio.file.*;
+import com.sun.tools.sjavac.Main;
+
+class ParallelCompilations extends SJavacTester {
+  public static void main(String[] args) throws Exception {
+    new ParallelCompilations().run();
+  }
+
+  public void run() throws Exception {
+    ToolBox tb = new ToolBox();
+    final String SERVER_ARG = "--server:"
+            + "portfile=testportfile,"
+            + "background=false";
+
+    // Generate 10 files
+    for (int i = 0; i < 10; i++) {
+      String fileName = "Test" + i;
+      String content = "package foo"+ i + ";\n" +
+                       "public class "+ fileName + "{\n" +
+                       "  public static void main(String[] args) {}\n" +
+                       "\n}";
+      Path srcDir = Paths.get("src");
+      tb.writeJavaFiles(srcDir,content);
+    }
+    //Method will throw an exception if compilation fails
+    compile("src", "-d", "classes", "-j", "10", SERVER_ARG, "--log=debug");
+  }
+}