changeset 3288:19ea84ae4992 icedtea-3.2.0pre02

Merge jdk8u102-b14
author andrew
date Fri, 05 Aug 2016 05:27:12 +0100
parents 57e01c898eaa (current diff) 0549bf2f507d (diff)
children 5665ca5e1896
files .hgtags
diffstat 10 files changed, 347 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Thu Aug 04 22:38:36 2016 +0100
+++ b/.hgtags	Fri Aug 05 05:27:12 2016 +0100
@@ -627,3 +627,24 @@
 0cef544b9eee7042001a2b7f5f9e8a48ef20d779 jdk8u101-b12
 05822f2e947be716d90fa20335b57c9ce5ee62aa icedtea-3.1.0
 88f7b4f1b721ab67ca4cd72e691d2f6c7a72c64b icedtea-3.2.0pre01
+8dc8f71216bf40c259bb4127270922fb6a6ca293 jdk8u101-b13
+10ffafaf53404de7fd23784aa3ff6016d107b9c8 jdk8u76-b00
+0caab0d65a04d8cce71976a6bdc1ca0841bcbcf0 jdk8u76-b01
+78f0aa6199150e10f387989b9bd5997f72cdc4e1 jdk8u76-b02
+8969d6096fe123922bb3ac0c8f6f7b18c1c7668e jdk8u76-b03
+f8173fa5db9ba23e7cd935600f56a8a53157eb6e jdk8u76-b04
+dad1f3dd4a906542a656b3f07142f90c1630320e jdk8u102-b00
+dad1f3dd4a906542a656b3f07142f90c1630320e jdk8u82-b00
+6adcc437e39d4e16803ea2ec2f77c7b2b014512f jdk8u102-b01
+8a650e6924641eff6398fa8cda6e9fd6bd486e71 jdk8u102-b02
+8a8745bff8d5d6dbe64563e051cfd228d2e4d917 jdk8u102-b03
+614dc9771517839b3ed68b6b549bef1c370651c9 jdk8u102-b04
+7750594d9ceba010e36349bc20ee011edbb7c577 jdk8u102-b05
+12d34c63fb1f4191efee852148758c7af67659da jdk8u102-b06
+e6bb6f4d7b7d5179dbf902b6ada968a873b0c58b jdk8u102-b07
+87b26b3123355302fa8d16cbdcfcdfac60ba0275 jdk8u102-b08
+b0bfb7878d4aa8bedcd1c572449ed7c4109fc71b jdk8u102-b09
+0b35a6329ffb892ab8d99a67dcfda1dbc26be91c jdk8u102-b10
+592d155cc1332eba606900a7273863c74ef082a4 jdk8u102-b11
+16c58d7af5a4937e46bccd58114a56a7ffcd685c jdk8u102-b12
+56b0df415b570e31dc0b97d4a1c8f28b85240089 jdk8u102-b13
--- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Aug 04 22:38:36 2016 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Aug 05 05:27:12 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, 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
@@ -249,6 +249,7 @@
      *  are correct.
      *
      *  @param tree     The tree whose kind and type is checked
+     *  @param found    The computed type of the tree
      *  @param ownkind  The computed kind of the tree
      *  @param resultInfo  The expected result of the tree
      */
--- a/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Thu Aug 04 22:38:36 2016 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java	Fri Aug 05 05:27:12 2016 +0100
@@ -860,7 +860,7 @@
         private JCExpression makeReceiver(VarSymbol rcvr) {
             if (rcvr == null) return null;
             JCExpression rcvrExpr = make.Ident(rcvr);
-            Type rcvrType = tree.sym.enclClass().type;
+            Type rcvrType = tree.ownerAccessible ? tree.sym.enclClass().type : tree.expr.type;
             if (rcvrType == syms.arrayClass.type) {
                 // Map the receiver type to the actually type, not just "array"
                 rcvrType = tree.getQualifierExpression().type;
--- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Aug 04 22:38:36 2016 +0100
+++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Fri Aug 05 05:27:12 2016 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2016, 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
@@ -1007,7 +1007,7 @@
                 DeferredType dt = (DeferredType)found;
                 return dt.check(this);
             } else {
-                Type uResult = U(found.baseType());
+                Type uResult = U(found);
                 Type capturedType = pos == null || pos.getTree() == null ?
                         types.capture(uResult) :
                         checkContext.inferenceContext()
--- a/src/share/classes/com/sun/tools/javac/util/GraphUtils.java	Thu Aug 04 22:38:36 2016 +0100
+++ b/src/share/classes/com/sun/tools/javac/util/GraphUtils.java	Fri Aug 05 05:27:12 2016 +0100
@@ -103,34 +103,60 @@
      * directed graph in linear time. Works on TarjanNode.
      */
     public static <D, N extends TarjanNode<D>> List<? extends List<? extends N>> tarjan(Iterable<? extends N> nodes) {
-        ListBuffer<List<N>> cycles = new ListBuffer<>();
-        ListBuffer<N> stack = new ListBuffer<>();
-        int index = 0;
-        for (N node: nodes) {
-            if (node.index == -1) {
-                index += tarjan(node, index, stack, cycles);
-            }
-        }
-        return cycles.toList();
+        Tarjan<D, N> tarjan = new Tarjan<>();
+        return tarjan.findSCC(nodes);
     }
 
-    private static <D, N extends TarjanNode<D>> int tarjan(N v, int index, ListBuffer<N> stack, ListBuffer<List<N>> cycles) {
-        v.index = index;
-        v.lowlink = index;
-        index++;
-        stack.prepend(v);
-        v.active = true;
-        for (TarjanNode<D> nd: v.getAllDependencies()) {
-            @SuppressWarnings("unchecked")
-            N n = (N)nd;
-            if (n.index == -1) {
-                tarjan(n, index, stack, cycles);
-                v.lowlink = Math.min(v.lowlink, n.lowlink);
-            } else if (stack.contains(n)) {
-                v.lowlink = Math.min(v.lowlink, n.index);
+    //where
+    private static class Tarjan<D, N extends TarjanNode<D>> {
+
+        /** Unique node identifier. */
+        int index = 0;
+
+        /** List of SCCs found so far. */
+        ListBuffer<List<N>> sccs = new ListBuffer<>();
+
+        /** Stack of all reacheable nodes from given root. */
+        ListBuffer<N> stack = new ListBuffer<>();
+
+        private List<? extends List<? extends N>> findSCC(Iterable<? extends N> nodes) {
+            for (N node : nodes) {
+                if (node.index == -1) {
+                    findSCC(node);
+                }
+            }
+            return sccs.toList();
+        }
+
+        private void findSCC(N v) {
+            visitNode(v);
+            for (TarjanNode<D> tn : v.getAllDependencies()) {
+                @SuppressWarnings("unchecked")
+                N n = (N)tn;
+                if (n.index == -1) {
+                    //it's the first time we see this node
+                    findSCC(n);
+                    v.lowlink = Math.min(v.lowlink, n.lowlink);
+                } else if (stack.contains(n)) {
+                    //this node is already reachable from current root
+                    v.lowlink = Math.min(v.lowlink, n.index);
+                }
+            }
+            if (v.lowlink == v.index) {
+                //v is the root of a SCC
+                addSCC(v);
             }
         }
-        if (v.lowlink == v.index) {
+
+        private void visitNode(N n) {
+            n.index = index;
+            n.lowlink = index;
+            index++;
+            stack.prepend(n);
+            n.active = true;
+        }
+
+        private void addSCC(N v) {
             N n;
             ListBuffer<N> cycle = new ListBuffer<>();
             do {
@@ -138,9 +164,8 @@
                 n.active = false;
                 cycle.add(n);
             } while (n != v);
-            cycles.add(cycle.toList());
+            sccs.add(cycle.toList());
         }
-        return index;
     }
 
     /**
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/conditional/ConditionalWithFinalStrings.java	Fri Aug 05 05:27:12 2016 +0100
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2016, 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 8066871
+ * @summary java.lang.VerifyError: Bad local variable type - local final String
+ * @author Srikanth Sankaran
+ *
+ * @compile -g:none ConditionalWithFinalStrings.java
+ * @run main ConditionalWithFinalStrings
+ */
+
+public class ConditionalWithFinalStrings {
+
+        interface I {
+            String foo();
+        }
+
+        static class Tmp {
+                private String value;
+                public void setValue(String tmpStr) {
+                        this.value = tmpStr;
+                        if (!this.value.equals("YES"))
+                            throw new AssertionError();
+                }
+        }
+
+        void goo(I i) {
+            if (!i.foo().equals("YES"))
+                throw new AssertionError();
+        }
+
+        public void test() {
+                final String y = "YES";
+                final String n = "NO";
+                Tmp tmp = new Tmp();
+                tmp.setValue(true ? y : n);
+                goo (() -> y);
+
+        }
+        public static void main(String[] args) {
+                new ConditionalWithFinalStrings().test();
+                if (!id("Hello!").equals("Hello!"))
+                    throw new AssertionError();
+
+        }
+        static <Z> Z id(Z z) { return z; }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/inference/8130304/T8130304.java	Fri Aug 05 05:27:12 2016 +0100
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2016, 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
+ * @bug 8130304
+ * @summary Inference: NodeNotFoundException thrown with deep generic method call chain
+ * @compile T8130304.java
+ */
+class T8130304 {
+
+    void test() {
+        outer(
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner(),
+            inner());
+    }
+
+    <T> void outer(T... ts) { }
+
+    <T,V,W extends V> T inner() {
+        return null;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/inference/8130304/T8130304b.java	Fri Aug 05 05:27:12 2016 +0100
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2016, 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
+ * @bug 8130304
+ * @summary Inference: NodeNotFoundException thrown with deep generic method call chain
+ * @compile T8130304b.java
+ */
+class T8130304b {
+
+    void test() {
+        TestZ r = null;
+        Crazy<String, String> x = r.m3("X");
+        r.m1(r.m4(r.m2(x, r.m3("a")), t -> "x"), r.m3("a"));
+    }
+
+    interface Crazy<A, B> { }
+
+    interface TestZ {
+        public <A, B> Crazy<A, B> m1(Crazy<A, ? extends B>... d);
+        public <A, B, C> Crazy<A, Crazy<B, C>> m2(Crazy<A, B> e, Crazy<A, C> f);
+        public <A> Crazy<A, A> m3(A g);
+        public <A, B, C> Crazy<A, C> m4(Crazy<A, B> h, java.util.function.Function<B, C> i);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/MethodReference75.java	Fri Aug 05 05:27:12 2016 +0100
@@ -0,0 +1,46 @@
+/*
+ * 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 8143647
+ * @summary Javac compiles method reference that allows results in an IllegalAccessError
+ * @run main MethodReference75
+ */
+
+import pkg.PublicDerived8143647;
+
+public class MethodReference75 {
+    public static void main(String[] args) {
+        if (java.util.Arrays
+                .asList(new PublicDerived8143647())
+                .stream()
+                .map(PublicDerived8143647::getX)
+                .findFirst()
+                .get()
+                .equals("PackagePrivateBase"))
+            System.out.println("OK");
+        else
+            throw new AssertionError("Unexpected output");
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/lambda/pkg/PublicDerived8143647.java	Fri Aug 05 05:27:12 2016 +0100
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+package pkg;
+
+abstract class PackagePrivateBase8143647 {
+    public String getX() {
+        return "PackagePrivateBase";
+    }
+}
+
+public class PublicDerived8143647 extends PackagePrivateBase8143647 {
+}