Tue, 16 Sep 2014 14:15:36 -0700
Merge
1.1 --- a/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Thu Sep 11 17:24:57 2014 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/DeferredAttr.java Tue Sep 16 14:15:36 2014 -0700 1.3 @@ -1314,6 +1314,12 @@ 1.4 site = env.enclClass.sym.type; 1.5 } 1.6 1.7 + while (site.hasTag(TYPEVAR)) { 1.8 + site = site.getUpperBound(); 1.9 + } 1.10 + 1.11 + site = types.capture(site); 1.12 + 1.13 List<Type> args = rs.dummyArgs(tree.args.length()); 1.14 Name name = TreeInfo.name(tree.meth); 1.15 1.16 @@ -1337,7 +1343,9 @@ 1.17 @Override 1.18 public Symbol process(MethodSymbol ms) { 1.19 ArgumentExpressionKind kind = ArgumentExpressionKind.methodKind(ms, types); 1.20 - return kind != ArgumentExpressionKind.POLY ? ms.getReturnType().tsym : null; 1.21 + if (kind == ArgumentExpressionKind.POLY || ms.getReturnType().hasTag(TYPEVAR)) 1.22 + return null; 1.23 + return ms.getReturnType().tsym; 1.24 } 1.25 @Override 1.26 public Symbol reduce(Symbol s1, Symbol s2) {
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/test/tools/javac/lambda/T8056014.java Tue Sep 16 14:15:36 2014 -0700 2.3 @@ -0,0 +1,70 @@ 2.4 +/* 2.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 2.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 2.7 + * 2.8 + * This code is free software; you can redistribute it and/or modify it 2.9 + * under the terms of the GNU General Public License version 2 only, as 2.10 + * published by the Free Software Foundation. 2.11 + * 2.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 2.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 2.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 2.15 + * version 2 for more details (a copy is included in the LICENSE file that 2.16 + * accompanied this code). 2.17 + * 2.18 + * You should have received a copy of the GNU General Public License version 2.19 + * 2 along with this work; if not, write to the Free Software Foundation, 2.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2.21 + * 2.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2.23 + * or visit www.oracle.com if you need additional information or have any 2.24 + * questions. 2.25 + */ 2.26 + 2.27 +/** 2.28 + * @test 2.29 + * @bug 8056014 2.30 + * @summary Verify that full type inference is used when calling a method on a type variable. 2.31 + * @compile T8056014.java 2.32 + * @run main T8056014 2.33 + */ 2.34 + 2.35 +import java.util.*; 2.36 + 2.37 +public class T8056014 { 2.38 + public static void main(String[] args) { 2.39 + new T8056014().run(); 2.40 + } 2.41 + 2.42 + void run() { 2.43 + List<S> l = Arrays.asList(new S()); 2.44 + C<S> c = new C<>(new S()); 2.45 + foo(l.get(0).copy(1)); 2.46 + foo(c.get(0).copy(1)); 2.47 + } 2.48 + 2.49 + void foo(S d) { 2.50 + } 2.51 +} 2.52 + 2.53 +class B { 2.54 + public B copy(long j) { 2.55 + throw new AssertionError("Should not get here."); 2.56 + } 2.57 +} 2.58 + 2.59 +class S extends B { 2.60 + public <T> T copy(int i) { 2.61 + return null; 2.62 + } 2.63 +} 2.64 + 2.65 +class C<T extends B> { 2.66 + final T t; 2.67 + public C(T t) { 2.68 + this.t = t; 2.69 + } 2.70 + public T get(int i) { 2.71 + return t; 2.72 + } 2.73 +}
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/test/tools/javac/lambda/T8056984.java Tue Sep 16 14:15:36 2014 -0700 3.3 @@ -0,0 +1,41 @@ 3.4 +/* 3.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 3.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3.7 + * 3.8 + * This code is free software; you can redistribute it and/or modify it 3.9 + * under the terms of the GNU General Public License version 2 only, as 3.10 + * published by the Free Software Foundation. 3.11 + * 3.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 3.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 3.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 3.15 + * version 2 for more details (a copy is included in the LICENSE file that 3.16 + * accompanied this code). 3.17 + * 3.18 + * You should have received a copy of the GNU General Public License version 3.19 + * 2 along with this work; if not, write to the Free Software Foundation, 3.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 3.21 + * 3.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 3.23 + * or visit www.oracle.com if you need additional information or have any 3.24 + * questions. 3.25 + */ 3.26 + 3.27 +/* 3.28 + * @test 3.29 + * @bug 8056984 3.30 + * @summary Ensure that method resolution runs over a captured type variables when checking if 3.31 + * deferred attribution is needed 3.32 + * @compile T8056984.java 3.33 + */ 3.34 +class T8056984<T1 extends B&C, T2 extends T1> { 3.35 + public T8056984(T1 t1, T2 t2) { 3.36 + System.err.println(t1.hashCode()); 3.37 + System.err.println(t2.hashCode()); 3.38 + } 3.39 +} 3.40 +class B { 3.41 +} 3.42 +interface C { 3.43 + public int hashCode(); 3.44 +}