Thu, 28 Apr 2016 10:05:33 -0700
Merge
.hgtags | file | annotate | diff | comparison | revisions |
1.1 --- a/.hgtags Mon Apr 11 12:35:04 2016 -0700 1.2 +++ b/.hgtags Thu Apr 28 10:05:33 2016 -0700 1.3 @@ -596,4 +596,18 @@ 1.4 a93c1e57407944362e05c79d756425e8c1274d9a jdk8u101-b01 1.5 86a9d99ffadaf26b3d8417666a3600ea1ce7560f jdk8u101-b02 1.6 6a0df041e6c9b0756f1cbc9e1fcb6f519b80d767 jdk8u101-b03 1.7 +90f493bfe1faca0573844fdd2497070c8b224d76 jdk8u101-b04 1.8 +52b1aad7837180baa6555b0b6a5e43e96aea2e19 jdk8u101-b05 1.9 +10ffafaf53404de7fd23784aa3ff6016d107b9c8 jdk8u76-b00 1.10 +0caab0d65a04d8cce71976a6bdc1ca0841bcbcf0 jdk8u76-b01 1.11 +78f0aa6199150e10f387989b9bd5997f72cdc4e1 jdk8u76-b02 1.12 +8969d6096fe123922bb3ac0c8f6f7b18c1c7668e jdk8u76-b03 1.13 +f8173fa5db9ba23e7cd935600f56a8a53157eb6e jdk8u76-b04 1.14 +dad1f3dd4a906542a656b3f07142f90c1630320e jdk8u102-b00 1.15 +dad1f3dd4a906542a656b3f07142f90c1630320e jdk8u82-b00 1.16 +6adcc437e39d4e16803ea2ec2f77c7b2b014512f jdk8u102-b01 1.17 +8a650e6924641eff6398fa8cda6e9fd6bd486e71 jdk8u102-b02 1.18 +8a8745bff8d5d6dbe64563e051cfd228d2e4d917 jdk8u102-b03 1.19 +614dc9771517839b3ed68b6b549bef1c370651c9 jdk8u102-b04 1.20 +7750594d9ceba010e36349bc20ee011edbb7c577 jdk8u102-b05 1.21 90f493bfe1faca0573844fdd2497070c8b224d76 jdk8u111-b00
2.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Mon Apr 11 12:35:04 2016 -0700 2.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Apr 28 10:05:33 2016 -0700 2.3 @@ -1,5 +1,5 @@ 2.4 /* 2.5 - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. 2.6 + * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. 2.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.8 * 2.9 * This code is free software; you can redistribute it and/or modify it 2.10 @@ -249,6 +249,7 @@ 2.11 * are correct. 2.12 * 2.13 * @param tree The tree whose kind and type is checked 2.14 + * @param found The computed type of the tree 2.15 * @param ownkind The computed kind of the tree 2.16 * @param resultInfo The expected result of the tree 2.17 */
3.1 --- a/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Mon Apr 11 12:35:04 2016 -0700 3.2 +++ b/src/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java Thu Apr 28 10:05:33 2016 -0700 3.3 @@ -860,7 +860,7 @@ 3.4 private JCExpression makeReceiver(VarSymbol rcvr) { 3.5 if (rcvr == null) return null; 3.6 JCExpression rcvrExpr = make.Ident(rcvr); 3.7 - Type rcvrType = tree.sym.enclClass().type; 3.8 + Type rcvrType = tree.ownerAccessible ? tree.sym.enclClass().type : tree.expr.type; 3.9 if (rcvrType == syms.arrayClass.type) { 3.10 // Map the receiver type to the actually type, not just "array" 3.11 rcvrType = tree.getQualifierExpression().type;
4.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Mon Apr 11 12:35:04 2016 -0700 4.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Apr 28 10:05:33 2016 -0700 4.3 @@ -1,5 +1,5 @@ 4.4 /* 4.5 - * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved. 4.6 + * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. 4.7 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.8 * 4.9 * This code is free software; you can redistribute it and/or modify it 4.10 @@ -1007,7 +1007,7 @@ 4.11 DeferredType dt = (DeferredType)found; 4.12 return dt.check(this); 4.13 } else { 4.14 - Type uResult = U(found.baseType()); 4.15 + Type uResult = U(found); 4.16 Type capturedType = pos == null || pos.getTree() == null ? 4.17 types.capture(uResult) : 4.18 checkContext.inferenceContext()
5.1 --- a/src/share/classes/com/sun/tools/javac/util/GraphUtils.java Mon Apr 11 12:35:04 2016 -0700 5.2 +++ b/src/share/classes/com/sun/tools/javac/util/GraphUtils.java Thu Apr 28 10:05:33 2016 -0700 5.3 @@ -103,34 +103,60 @@ 5.4 * directed graph in linear time. Works on TarjanNode. 5.5 */ 5.6 public static <D, N extends TarjanNode<D>> List<? extends List<? extends N>> tarjan(Iterable<? extends N> nodes) { 5.7 - ListBuffer<List<N>> cycles = new ListBuffer<>(); 5.8 + Tarjan<D, N> tarjan = new Tarjan<>(); 5.9 + return tarjan.findSCC(nodes); 5.10 + } 5.11 + 5.12 + //where 5.13 + private static class Tarjan<D, N extends TarjanNode<D>> { 5.14 + 5.15 + /** Unique node identifier. */ 5.16 + int index = 0; 5.17 + 5.18 + /** List of SCCs found so far. */ 5.19 + ListBuffer<List<N>> sccs = new ListBuffer<>(); 5.20 + 5.21 + /** Stack of all reacheable nodes from given root. */ 5.22 ListBuffer<N> stack = new ListBuffer<>(); 5.23 - int index = 0; 5.24 - for (N node: nodes) { 5.25 - if (node.index == -1) { 5.26 - index += tarjan(node, index, stack, cycles); 5.27 + 5.28 + private List<? extends List<? extends N>> findSCC(Iterable<? extends N> nodes) { 5.29 + for (N node : nodes) { 5.30 + if (node.index == -1) { 5.31 + findSCC(node); 5.32 + } 5.33 + } 5.34 + return sccs.toList(); 5.35 + } 5.36 + 5.37 + private void findSCC(N v) { 5.38 + visitNode(v); 5.39 + for (TarjanNode<D> tn : v.getAllDependencies()) { 5.40 + @SuppressWarnings("unchecked") 5.41 + N n = (N)tn; 5.42 + if (n.index == -1) { 5.43 + //it's the first time we see this node 5.44 + findSCC(n); 5.45 + v.lowlink = Math.min(v.lowlink, n.lowlink); 5.46 + } else if (stack.contains(n)) { 5.47 + //this node is already reachable from current root 5.48 + v.lowlink = Math.min(v.lowlink, n.index); 5.49 + } 5.50 + } 5.51 + if (v.lowlink == v.index) { 5.52 + //v is the root of a SCC 5.53 + addSCC(v); 5.54 } 5.55 } 5.56 - return cycles.toList(); 5.57 - } 5.58 5.59 - private static <D, N extends TarjanNode<D>> int tarjan(N v, int index, ListBuffer<N> stack, ListBuffer<List<N>> cycles) { 5.60 - v.index = index; 5.61 - v.lowlink = index; 5.62 - index++; 5.63 - stack.prepend(v); 5.64 - v.active = true; 5.65 - for (TarjanNode<D> nd: v.getAllDependencies()) { 5.66 - @SuppressWarnings("unchecked") 5.67 - N n = (N)nd; 5.68 - if (n.index == -1) { 5.69 - tarjan(n, index, stack, cycles); 5.70 - v.lowlink = Math.min(v.lowlink, n.lowlink); 5.71 - } else if (stack.contains(n)) { 5.72 - v.lowlink = Math.min(v.lowlink, n.index); 5.73 - } 5.74 + private void visitNode(N n) { 5.75 + n.index = index; 5.76 + n.lowlink = index; 5.77 + index++; 5.78 + stack.prepend(n); 5.79 + n.active = true; 5.80 } 5.81 - if (v.lowlink == v.index) { 5.82 + 5.83 + private void addSCC(N v) { 5.84 N n; 5.85 ListBuffer<N> cycle = new ListBuffer<>(); 5.86 do { 5.87 @@ -138,9 +164,8 @@ 5.88 n.active = false; 5.89 cycle.add(n); 5.90 } while (n != v); 5.91 - cycles.add(cycle.toList()); 5.92 + sccs.add(cycle.toList()); 5.93 } 5.94 - return index; 5.95 } 5.96 5.97 /**
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/test/tools/javac/conditional/ConditionalWithFinalStrings.java Thu Apr 28 10:05:33 2016 -0700 6.3 @@ -0,0 +1,69 @@ 6.4 +/* 6.5 + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 6.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 6.7 + * 6.8 + * This code is free software; you can redistribute it and/or modify it 6.9 + * under the terms of the GNU General Public License version 2 only, as 6.10 + * published by the Free Software Foundation. 6.11 + * 6.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 6.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 6.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 6.15 + * version 2 for more details (a copy is included in the LICENSE file that 6.16 + * accompanied this code). 6.17 + * 6.18 + * You should have received a copy of the GNU General Public License version 6.19 + * 2 along with this work; if not, write to the Free Software Foundation, 6.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 6.21 + * 6.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 6.23 + * or visit www.oracle.com if you need additional information or have any 6.24 + * questions. 6.25 + */ 6.26 + 6.27 +/* 6.28 + * @test 6.29 + * @bug 8066871 6.30 + * @summary java.lang.VerifyError: Bad local variable type - local final String 6.31 + * @author Srikanth Sankaran 6.32 + * 6.33 + * @compile -g:none ConditionalWithFinalStrings.java 6.34 + * @run main ConditionalWithFinalStrings 6.35 + */ 6.36 + 6.37 +public class ConditionalWithFinalStrings { 6.38 + 6.39 + interface I { 6.40 + String foo(); 6.41 + } 6.42 + 6.43 + static class Tmp { 6.44 + private String value; 6.45 + public void setValue(String tmpStr) { 6.46 + this.value = tmpStr; 6.47 + if (!this.value.equals("YES")) 6.48 + throw new AssertionError(); 6.49 + } 6.50 + } 6.51 + 6.52 + void goo(I i) { 6.53 + if (!i.foo().equals("YES")) 6.54 + throw new AssertionError(); 6.55 + } 6.56 + 6.57 + public void test() { 6.58 + final String y = "YES"; 6.59 + final String n = "NO"; 6.60 + Tmp tmp = new Tmp(); 6.61 + tmp.setValue(true ? y : n); 6.62 + goo (() -> y); 6.63 + 6.64 + } 6.65 + public static void main(String[] args) { 6.66 + new ConditionalWithFinalStrings().test(); 6.67 + if (!id("Hello!").equals("Hello!")) 6.68 + throw new AssertionError(); 6.69 + 6.70 + } 6.71 + static <Z> Z id(Z z) { return z; } 6.72 +}
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/test/tools/javac/generics/inference/8130304/T8130304.java Thu Apr 28 10:05:33 2016 -0700 7.3 @@ -0,0 +1,74 @@ 7.4 +/* 7.5 + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 7.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 7.7 + * 7.8 + * This code is free software; you can redistribute it and/or modify it 7.9 + * under the terms of the GNU General Public License version 2 only, as 7.10 + * published by the Free Software Foundation. Oracle designates this 7.11 + * particular file as subject to the "Classpath" exception as provided 7.12 + * by Oracle in the LICENSE file that accompanied this code. 7.13 + * 7.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 7.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 7.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 7.17 + * version 2 for more details (a copy is included in the LICENSE file that 7.18 + * accompanied this code). 7.19 + * 7.20 + * You should have received a copy of the GNU General Public License version 7.21 + * 2 along with this work; if not, write to the Free Software Foundation, 7.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 7.23 + * 7.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 7.25 + * or visit www.oracle.com if you need additional information or have any 7.26 + * questions. 7.27 + */ 7.28 + 7.29 +/** 7.30 + * @test 7.31 + * @bug 8130304 7.32 + * @summary Inference: NodeNotFoundException thrown with deep generic method call chain 7.33 + * @compile T8130304.java 7.34 + */ 7.35 +class T8130304 { 7.36 + 7.37 + void test() { 7.38 + outer( 7.39 + inner(), 7.40 + inner(), 7.41 + inner(), 7.42 + inner(), 7.43 + inner(), 7.44 + inner(), 7.45 + inner(), 7.46 + inner(), 7.47 + inner(), 7.48 + inner(), 7.49 + inner(), 7.50 + inner(), 7.51 + inner(), 7.52 + inner(), 7.53 + inner(), 7.54 + inner(), 7.55 + inner(), 7.56 + inner(), 7.57 + inner(), 7.58 + inner(), 7.59 + inner(), 7.60 + inner(), 7.61 + inner(), 7.62 + inner(), 7.63 + inner(), 7.64 + inner(), 7.65 + inner(), 7.66 + inner(), 7.67 + inner(), 7.68 + inner(), 7.69 + inner()); 7.70 + } 7.71 + 7.72 + <T> void outer(T... ts) { } 7.73 + 7.74 + <T,V,W extends V> T inner() { 7.75 + return null; 7.76 + } 7.77 +}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/test/tools/javac/generics/inference/8130304/T8130304b.java Thu Apr 28 10:05:33 2016 -0700 8.3 @@ -0,0 +1,48 @@ 8.4 +/* 8.5 + * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. 8.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.7 + * 8.8 + * This code is free software; you can redistribute it and/or modify it 8.9 + * under the terms of the GNU General Public License version 2 only, as 8.10 + * published by the Free Software Foundation. Oracle designates this 8.11 + * particular file as subject to the "Classpath" exception as provided 8.12 + * by Oracle in the LICENSE file that accompanied this code. 8.13 + * 8.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 8.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 8.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 8.17 + * version 2 for more details (a copy is included in the LICENSE file that 8.18 + * accompanied this code). 8.19 + * 8.20 + * You should have received a copy of the GNU General Public License version 8.21 + * 2 along with this work; if not, write to the Free Software Foundation, 8.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 8.23 + * 8.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 8.25 + * or visit www.oracle.com if you need additional information or have any 8.26 + * questions. 8.27 + */ 8.28 + 8.29 +/** 8.30 + * @test 8.31 + * @bug 8130304 8.32 + * @summary Inference: NodeNotFoundException thrown with deep generic method call chain 8.33 + * @compile T8130304b.java 8.34 + */ 8.35 +class T8130304b { 8.36 + 8.37 + void test() { 8.38 + TestZ r = null; 8.39 + Crazy<String, String> x = r.m3("X"); 8.40 + r.m1(r.m4(r.m2(x, r.m3("a")), t -> "x"), r.m3("a")); 8.41 + } 8.42 + 8.43 + interface Crazy<A, B> { } 8.44 + 8.45 + interface TestZ { 8.46 + public <A, B> Crazy<A, B> m1(Crazy<A, ? extends B>... d); 8.47 + public <A, B, C> Crazy<A, Crazy<B, C>> m2(Crazy<A, B> e, Crazy<A, C> f); 8.48 + public <A> Crazy<A, A> m3(A g); 8.49 + public <A, B, C> Crazy<A, C> m4(Crazy<A, B> h, java.util.function.Function<B, C> i); 8.50 + } 8.51 +}
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/test/tools/javac/lambda/MethodReference75.java Thu Apr 28 10:05:33 2016 -0700 9.3 @@ -0,0 +1,46 @@ 9.4 +/* 9.5 + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. 9.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 9.7 + * 9.8 + * This code is free software; you can redistribute it and/or modify it 9.9 + * under the terms of the GNU General Public License version 2 only, as 9.10 + * published by the Free Software Foundation. 9.11 + * 9.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 9.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 9.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 9.15 + * version 2 for more details (a copy is included in the LICENSE file that 9.16 + * accompanied this code). 9.17 + * 9.18 + * You should have received a copy of the GNU General Public License version 9.19 + * 2 along with this work; if not, write to the Free Software Foundation, 9.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 9.21 + * 9.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 9.23 + * or visit www.oracle.com if you need additional information or have any 9.24 + * questions. 9.25 + */ 9.26 + 9.27 +/* 9.28 + * @test 9.29 + * @bug 8143647 9.30 + * @summary Javac compiles method reference that allows results in an IllegalAccessError 9.31 + * @run main MethodReference75 9.32 + */ 9.33 + 9.34 +import pkg.PublicDerived8143647; 9.35 + 9.36 +public class MethodReference75 { 9.37 + public static void main(String[] args) { 9.38 + if (java.util.Arrays 9.39 + .asList(new PublicDerived8143647()) 9.40 + .stream() 9.41 + .map(PublicDerived8143647::getX) 9.42 + .findFirst() 9.43 + .get() 9.44 + .equals("PackagePrivateBase")) 9.45 + System.out.println("OK"); 9.46 + else 9.47 + throw new AssertionError("Unexpected output"); 9.48 + } 9.49 +}
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/test/tools/javac/lambda/pkg/PublicDerived8143647.java Thu Apr 28 10:05:33 2016 -0700 10.3 @@ -0,0 +1,33 @@ 10.4 +/* 10.5 + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. 10.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 10.7 + * 10.8 + * This code is free software; you can redistribute it and/or modify it 10.9 + * under the terms of the GNU General Public License version 2 only, as 10.10 + * published by the Free Software Foundation. 10.11 + * 10.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 10.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 10.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 10.15 + * version 2 for more details (a copy is included in the LICENSE file that 10.16 + * accompanied this code). 10.17 + * 10.18 + * You should have received a copy of the GNU General Public License version 10.19 + * 2 along with this work; if not, write to the Free Software Foundation, 10.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 10.21 + * 10.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 10.23 + * or visit www.oracle.com if you need additional information or have any 10.24 + * questions. 10.25 + */ 10.26 + 10.27 +package pkg; 10.28 + 10.29 +abstract class PackagePrivateBase8143647 { 10.30 + public String getX() { 10.31 + return "PackagePrivateBase"; 10.32 + } 10.33 +} 10.34 + 10.35 +public class PublicDerived8143647 extends PackagePrivateBase8143647 { 10.36 +}