Thu, 28 Feb 2013 14:05:52 +0000
8008537: Missing method reference lookup error when unbound search finds a static method
Summary: Static-ness check should be applied after member reference resolution
Reviewed-by: jjg
1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Feb 28 14:05:44 2013 +0000 1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu Feb 28 14:05:52 2013 +0000 1.3 @@ -2624,7 +2624,34 @@ 1.4 that.sym = refSym.baseSymbol(); 1.5 that.kind = lookupHelper.referenceKind(that.sym); 1.6 1.7 + if (desc.getReturnType() == Type.recoveryType) { 1.8 + // stop here 1.9 + result = that.type = target; 1.10 + return; 1.11 + } 1.12 + 1.13 if (resultInfo.checkContext.deferredAttrContext().mode == AttrMode.CHECK) { 1.14 + 1.15 + if (!that.kind.isUnbound() && 1.16 + that.getMode() == ReferenceMode.INVOKE && 1.17 + TreeInfo.isStaticSelector(that.expr, names) && 1.18 + !that.sym.isStatic()) { 1.19 + log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()), 1.20 + diags.fragment("non-static.cant.be.ref", Kinds.kindName(refSym), refSym)); 1.21 + result = that.type = types.createErrorType(target); 1.22 + return; 1.23 + } 1.24 + 1.25 + if (that.kind.isUnbound() && 1.26 + that.getMode() == ReferenceMode.INVOKE && 1.27 + TreeInfo.isStaticSelector(that.expr, names) && 1.28 + that.sym.isStatic()) { 1.29 + log.error(that.expr.pos(), "invalid.mref", Kinds.kindName(that.getMode()), 1.30 + diags.fragment("static.method.in.unbound.lookup", Kinds.kindName(refSym), refSym)); 1.31 + result = that.type = types.createErrorType(target); 1.32 + return; 1.33 + } 1.34 + 1.35 if (that.sym.isStatic() && TreeInfo.isStaticSelector(that.expr, names) && 1.36 exprType.getTypeArguments().nonEmpty()) { 1.37 //static ref with class type-args 1.38 @@ -2649,12 +2676,6 @@ 1.39 } 1.40 } 1.41 1.42 - if (desc.getReturnType() == Type.recoveryType) { 1.43 - // stop here 1.44 - result = that.type = target; 1.45 - return; 1.46 - } 1.47 - 1.48 that.sym = refSym.baseSymbol(); 1.49 that.kind = lookupHelper.referenceKind(that.sym); 1.50
2.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Feb 28 14:05:44 2013 +0000 2.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Feb 28 14:05:52 2013 +0000 2.3 @@ -2661,22 +2661,12 @@ 2.4 super(referenceTree, name, site, argtypes, typeargtypes, maxPhase); 2.5 } 2.6 2.7 - protected Symbol lookupReferenceInternal(Env<AttrContext> env, MethodResolutionPhase phase) { 2.8 + @Override 2.9 + final Symbol lookup(Env<AttrContext> env, MethodResolutionPhase phase) { 2.10 return findMethod(env, site, name, argtypes, typeargtypes, 2.11 phase.isBoxingRequired(), phase.isVarargsRequired(), syms.operatorNames.contains(name)); 2.12 } 2.13 2.14 - protected Symbol adjustLookupResult(Env<AttrContext> env, Symbol sym) { 2.15 - return !TreeInfo.isStaticSelector(referenceTree.expr, names) || 2.16 - sym.kind != MTH || 2.17 - sym.isStatic() ? sym : new StaticError(sym); 2.18 - } 2.19 - 2.20 - @Override 2.21 - final Symbol lookup(Env<AttrContext> env, MethodResolutionPhase phase) { 2.22 - return adjustLookupResult(env, lookupReferenceInternal(env, phase)); 2.23 - } 2.24 - 2.25 @Override 2.26 ReferenceLookupHelper unboundLookup() { 2.27 if (TreeInfo.isStaticSelector(referenceTree.expr, names) && 2.28 @@ -2721,11 +2711,6 @@ 2.29 } 2.30 2.31 @Override 2.32 - protected Symbol adjustLookupResult(Env<AttrContext> env, Symbol sym) { 2.33 - return sym.kind != MTH || !sym.isStatic() ? sym : new StaticError(sym); 2.34 - } 2.35 - 2.36 - @Override 2.37 ReferenceLookupHelper unboundLookup() { 2.38 return this; 2.39 }
3.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Feb 28 14:05:44 2013 +0000 3.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties Thu Feb 28 14:05:52 2013 +0000 3.3 @@ -1901,6 +1901,10 @@ 3.4 compiler.misc.non-static.cant.be.ref=\ 3.5 non-static {0} {1} cannot be referenced from a static context 3.6 3.7 +# 0: symbol kind, 1: symbol 3.8 +compiler.misc.static.method.in.unbound.lookup=\ 3.9 + static {0} {1} found in unbound lookup 3.10 + 3.11 ## Both arguments ({0}, {1}) are "kindname"s. {0} is a comma-separated list 3.12 ## of kindnames (the list should be identical to that provided in source. 3.13 compiler.err.unexpected.type=\
4.1 --- a/test/tools/javac/diags/examples/NonStaticCantBeRefFragment.java Thu Feb 28 14:05:44 2013 +0000 4.2 +++ b/test/tools/javac/diags/examples/NonStaticCantBeRefFragment.java Thu Feb 28 14:05:52 2013 +0000 4.3 @@ -21,9 +21,8 @@ 4.4 * questions. 4.5 */ 4.6 4.7 -// key: compiler.err.prob.found.req 4.8 // key: compiler.misc.non-static.cant.be.ref 4.9 -// key: compiler.misc.invalid.mref 4.10 +// key: compiler.err.invalid.mref 4.11 4.12 class NonStaticCantBeRefFragment { 4.13
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/test/tools/javac/diags/examples/StaticMethodInUnboundLookup.java Thu Feb 28 14:05:52 2013 +0000 5.3 @@ -0,0 +1,36 @@ 5.4 +/* 5.5 + * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. 5.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 5.7 + * 5.8 + * This code is free software; you can redistribute it and/or modify it 5.9 + * under the terms of the GNU General Public License version 2 only, as 5.10 + * published by the Free Software Foundation. 5.11 + * 5.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 5.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 5.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 5.15 + * version 2 for more details (a copy is included in the LICENSE file that 5.16 + * accompanied this code). 5.17 + * 5.18 + * You should have received a copy of the GNU General Public License version 5.19 + * 2 along with this work; if not, write to the Free Software Foundation, 5.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 5.21 + * 5.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 5.23 + * or visit www.oracle.com if you need additional information or have any 5.24 + * questions. 5.25 + */ 5.26 + 5.27 +// key: compiler.err.invalid.mref 5.28 +// key: compiler.misc.static.method.in.unbound.lookup 5.29 + 5.30 +class StaticBoundMref { 5.31 + 5.32 + interface SAM { 5.33 + void m(StaticBoundMref m); 5.34 + } 5.35 + 5.36 + SAM s = StaticBoundMref::m; 5.37 + 5.38 + static void m() { } 5.39 +}
6.1 --- a/test/tools/javac/lambda/MethodReference22.java Thu Feb 28 14:05:44 2013 +0000 6.2 +++ b/test/tools/javac/lambda/MethodReference22.java Thu Feb 28 14:05:52 2013 +0000 6.3 @@ -48,19 +48,19 @@ 6.4 } 6.5 6.6 static void test2() { 6.7 - SAM2 s1 = MethodReference22::m1; //ok 6.8 - call2(MethodReference22::m1); //ok 6.9 - SAM2 s2 = MethodReference22::m2; //ok 6.10 - call2(MethodReference22::m2); //ok 6.11 - SAM2 s3 = MethodReference22::m3; //fail 6.12 - call2(MethodReference22::m3); //fail 6.13 - SAM2 s4 = MethodReference22::m4; //fail 6.14 - call2(MethodReference22::m4); //fail 6.15 + SAM2 s1 = MethodReference22::m1; //ambiguous 6.16 + call2(MethodReference22::m1); //ambiguous 6.17 + SAM2 s2 = MethodReference22::m2; //ambiguous 6.18 + call2(MethodReference22::m2); //ambiguous 6.19 + SAM2 s3 = MethodReference22::m3; //ambiguous 6.20 + call2(MethodReference22::m3); //ambiguous 6.21 + SAM2 s4 = MethodReference22::m4; //ambiguous 6.22 + call2(MethodReference22::m4); //ambiguous 6.23 } 6.24 6.25 static void test3() { 6.26 - call3(MethodReference22::m1); //ok 6.27 - call3(MethodReference22::m2); //ambiguous 6.28 + call3(MethodReference22::m1); //fail 6.29 + call3(MethodReference22::m2); //ok 6.30 call3(MethodReference22::m3); //ok 6.31 call3(MethodReference22::m4); //fail 6.32 }
7.1 --- a/test/tools/javac/lambda/MethodReference22.out Thu Feb 28 14:05:44 2013 +0000 7.2 +++ b/test/tools/javac/lambda/MethodReference22.out Thu Feb 28 14:05:52 2013 +0000 7.3 @@ -1,11 +1,15 @@ 7.4 -MethodReference22.java:40:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m1(java.lang.String))) 7.5 -MethodReference22.java:41:9: compiler.err.cant.apply.symbol: kindname.method, call1, MethodReference22.SAM1, @999, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m1(java.lang.String)))) 7.6 -MethodReference22.java:46:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m4(java.lang.String))) 7.7 -MethodReference22.java:47:9: compiler.err.cant.apply.symbol: kindname.method, call1, MethodReference22.SAM1, @1270, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m4(java.lang.String)))) 7.8 -MethodReference22.java:55:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m3(MethodReference22,java.lang.String))) 7.9 -MethodReference22.java:56:9: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1574, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m3(MethodReference22,java.lang.String)))) 7.10 +MethodReference22.java:40:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m1(java.lang.String)) 7.11 +MethodReference22.java:41:15: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m1(java.lang.String)) 7.12 +MethodReference22.java:46:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m4(java.lang.String)) 7.13 +MethodReference22.java:47:15: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m4(java.lang.String)) 7.14 +MethodReference22.java:51:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m1, kindname.method, m1(MethodReference22,java.lang.String), MethodReference22, kindname.method, m1(java.lang.String), MethodReference22)) 7.15 +MethodReference22.java:52:9: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1401, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m1, kindname.method, m1(MethodReference22,java.lang.String), MethodReference22, kindname.method, m1(java.lang.String), MethodReference22))) 7.16 +MethodReference22.java:53:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m2, kindname.method, m2(MethodReference22,java.lang.String), MethodReference22, kindname.method, m2(java.lang.String), MethodReference22)) 7.17 +MethodReference22.java:54:9: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1504, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m2, kindname.method, m2(MethodReference22,java.lang.String), MethodReference22, kindname.method, m2(java.lang.String), MethodReference22))) 7.18 +MethodReference22.java:55:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m3, kindname.method, m3(MethodReference22,java.lang.String), MethodReference22, kindname.method, m3(java.lang.String), MethodReference22)) 7.19 +MethodReference22.java:56:9: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1607, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m3, kindname.method, m3(MethodReference22,java.lang.String), MethodReference22, kindname.method, m3(java.lang.String), MethodReference22))) 7.20 MethodReference22.java:57:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference22,java.lang.String), MethodReference22, kindname.method, m4(java.lang.String), MethodReference22)) 7.21 -MethodReference22.java:58:9: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1667, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference22,java.lang.String), MethodReference22, kindname.method, m4(java.lang.String), MethodReference22))) 7.22 -MethodReference22.java:63:9: compiler.err.ref.ambiguous: call3, kindname.method, call3(MethodReference22.SAM1), MethodReference22, kindname.method, call3(MethodReference22.SAM2), MethodReference22 7.23 -MethodReference22.java:65:9: compiler.err.cant.apply.symbols: kindname.method, call3, @1881,{(compiler.misc.inapplicable.method: kindname.method, MethodReference22, call3(MethodReference22.SAM1), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m4(java.lang.String))))),(compiler.misc.inapplicable.method: kindname.method, MethodReference22, call3(MethodReference22.SAM2), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference22,java.lang.String), MethodReference22, kindname.method, m4(java.lang.String), MethodReference22))))} 7.24 -10 errors 7.25 +MethodReference22.java:58:9: compiler.err.cant.apply.symbol: kindname.method, call2, MethodReference22.SAM2, @1710, kindname.class, MethodReference22, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: m4, kindname.method, m4(MethodReference22,java.lang.String), MethodReference22, kindname.method, m4(java.lang.String), MethodReference22))) 7.26 +MethodReference22.java:62:15: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m1(java.lang.String)) 7.27 +MethodReference22.java:65:15: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m4(java.lang.String)) 7.28 +14 errors
8.1 --- a/test/tools/javac/lambda/MethodReference28.out Thu Feb 28 14:05:44 2013 +0000 8.2 +++ b/test/tools/javac/lambda/MethodReference28.out Thu Feb 28 14:05:52 2013 +0000 8.3 @@ -1,7 +1,7 @@ 8.4 MethodReference28.java:31:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, static_m2, java.lang.Integer,java.lang.Integer, int, kindname.class, MethodReference28, (compiler.misc.arg.length.mismatch))) 8.5 MethodReference28.java:32:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, static_m3, java.lang.String, int, kindname.class, MethodReference28, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String)))) 8.6 MethodReference28.java:33:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, static_m4, java.lang.String[], int, kindname.class, MethodReference28, (compiler.misc.varargs.argument.mismatch: (compiler.misc.inconvertible.types: int, java.lang.String)))) 8.7 -MethodReference28.java:37:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m1(java.lang.Integer))) 8.8 +MethodReference28.java:37:19: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, m1(java.lang.Integer)) 8.9 MethodReference28.java:38:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m2, java.lang.Integer,java.lang.Integer, int, kindname.class, MethodReference28, (compiler.misc.arg.length.mismatch))) 8.10 MethodReference28.java:39:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m3, java.lang.String, int, kindname.class, MethodReference28, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String)))) 8.11 MethodReference28.java:40:19: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m4, java.lang.String[], int, kindname.class, MethodReference28, (compiler.misc.varargs.argument.mismatch: (compiler.misc.inconvertible.types: int, java.lang.String))))
9.1 --- a/test/tools/javac/lambda/MethodReference51.out Thu Feb 28 14:05:44 2013 +0000 9.2 +++ b/test/tools/javac/lambda/MethodReference51.out Thu Feb 28 14:05:52 2013 +0000 9.3 @@ -2,6 +2,6 @@ 9.4 MethodReference51.java:40:21: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, f, java.lang.String, int, kindname.class, MethodReference51, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: int, java.lang.String)))) 9.5 MethodReference51.java:41:21: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbols: kindname.method, g, int,{(compiler.misc.inapplicable.method: kindname.method, MethodReference51, g(java.lang.Integer,java.lang.Number), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.method, MethodReference51, g(java.lang.Number,java.lang.Integer), (compiler.misc.arg.length.mismatch))})) 9.6 MethodReference51.java:42:32: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.ref.ambiguous: g, kindname.method, g(java.lang.Integer,java.lang.Number), MethodReference51, kindname.method, g(java.lang.Number,java.lang.Integer), MethodReference51)) 9.7 -MethodReference51.java:43:21: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, h(int))) 9.8 +MethodReference51.java:43:21: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, h(int)) 9.9 MethodReference51.java:44:21: compiler.err.prob.found.req: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.not.def.access.class.intf.cant.access: j(int), MethodReference51.Foo)) 9.10 6 errors
10.1 --- a/test/tools/javac/lambda/TargetType60.java Thu Feb 28 14:05:44 2013 +0000 10.2 +++ b/test/tools/javac/lambda/TargetType60.java Thu Feb 28 14:05:52 2013 +0000 10.3 @@ -29,10 +29,24 @@ 10.4 void m012(String s) { } 10.5 void m012(String s1, String s2) { } 10.6 10.7 + void n0() { } 10.8 + void n1(String s) { } 10.9 + void n2(TargetType60 rec, String s2) { } 10.10 + 10.11 + void n01() { } 10.12 + void n01(String s) { } 10.13 + 10.14 + void n012() { } 10.15 + void n012(String s) { } 10.16 + void n012(TargetType60 rec, String s2) { } 10.17 + 10.18 static String g(Sam0 s) { return null; } 10.19 static <U> U g(Sam1<U> s) { return null; } 10.20 static <U> U g(Sam2<U,String> s) { return null; } 10.21 10.22 + static <U> U u(Sam1<U> s) { return null; } 10.23 + static <U> U u(Sam2<U,String> s) { return null; } 10.24 + 10.25 void testBound() { 10.26 String s1 = g(this::m0); //ok - resolves to g(Sam0) 10.27 String s2 = g(this::m1); //ok - resolves to g(Sam1) 10.28 @@ -42,10 +56,10 @@ 10.29 } 10.30 10.31 static void testUnbound() { 10.32 - TargetType60 s1 = g(TargetType60::m0); //ok - resolves to g(Sam1) 10.33 - TargetType60 s2 = g(TargetType60::m1); //ok - resolves to g(Sam2) 10.34 - TargetType60 s3 = g(TargetType60::m2); //none is applicable 10.35 - TargetType60 s4 = g(TargetType60::m01);//ambiguous (g(Sam1), g(Sam2) apply) 10.36 - TargetType60 s5 = g(TargetType60::m012);//ambiguous (g(Sam1), g(Sam2) apply) 10.37 + TargetType60 s1 = u(TargetType60::n0); //ok - resolves to u(Sam1) 10.38 + TargetType60 s2 = u(TargetType60::n1); //ambiguous (u(Sam1), u(Sam2) apply) 10.39 + TargetType60 s3 = u(TargetType60::n2); //none is applicable 10.40 + TargetType60 s4 = u(TargetType60::n01);//ambiguous (u(Sam1), u(Sam2) apply) 10.41 + TargetType60 s5 = u(TargetType60::n012);//ambiguous (u(Sam1), u(Sam2) apply) 10.42 } 10.43 }
11.1 --- a/test/tools/javac/lambda/TargetType60.out Thu Feb 28 14:05:44 2013 +0000 11.2 +++ b/test/tools/javac/lambda/TargetType60.out Thu Feb 28 14:05:52 2013 +0000 11.3 @@ -1,6 +1,8 @@ 11.4 -TargetType60.java:40:21: compiler.err.ref.ambiguous: g, kindname.method, g(TargetType60.Sam0), TargetType60, kindname.method, <U>g(TargetType60.Sam1<U>), TargetType60 11.5 -TargetType60.java:41:21: compiler.err.ref.ambiguous: g, kindname.method, <U>g(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>g(TargetType60.Sam2<U,java.lang.String>), TargetType60 11.6 -TargetType60.java:47:27: compiler.err.cant.apply.symbols: kindname.method, g, @1304,{(compiler.misc.inapplicable.method: kindname.method, TargetType60, g(TargetType60.Sam0), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, m2, java.lang.String,java.lang.String, compiler.misc.no.args, kindname.class, TargetType60, (compiler.misc.arg.length.mismatch))))),(compiler.misc.inapplicable.method: kindname.method, TargetType60, <U>g(TargetType60.Sam1<U>), (compiler.misc.infer.no.conforming.assignment.exists: U, (compiler.misc.incompatible.arg.types.in.mref))),(compiler.misc.inapplicable.method: kindname.method, TargetType60, <U>g(TargetType60.Sam2<U,java.lang.String>), (compiler.misc.infer.no.conforming.assignment.exists: U, (compiler.misc.incompatible.arg.types.in.mref)))} 11.7 -TargetType60.java:48:27: compiler.err.ref.ambiguous: g, kindname.method, <U>g(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>g(TargetType60.Sam2<U,java.lang.String>), TargetType60 11.8 -TargetType60.java:49:27: compiler.err.ref.ambiguous: g, kindname.method, <U>g(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>g(TargetType60.Sam2<U,java.lang.String>), TargetType60 11.9 -5 errors 11.10 +TargetType60.java:54:21: compiler.err.ref.ambiguous: g, kindname.method, g(TargetType60.Sam0), TargetType60, kindname.method, <U>g(TargetType60.Sam1<U>), TargetType60 11.11 +TargetType60.java:55:21: compiler.err.ref.ambiguous: g, kindname.method, <U>g(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>g(TargetType60.Sam2<U,java.lang.String>), TargetType60 11.12 +TargetType60.java:60:27: compiler.err.ref.ambiguous: u, kindname.method, <U>u(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>u(TargetType60.Sam2<U,java.lang.String>), TargetType60 11.13 +TargetType60.java:60:28: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.assignment.exists: U, (compiler.misc.invalid.mref: kindname.method, (compiler.misc.cant.apply.symbol: kindname.method, n1, java.lang.String, TargetType60, kindname.class, TargetType60, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inconvertible.types: TargetType60, java.lang.String))))) 11.14 +TargetType60.java:61:29: compiler.err.invalid.mref: kindname.method, (compiler.misc.non-static.cant.be.ref: kindname.method, n2(TargetType60,java.lang.String)) 11.15 +TargetType60.java:62:27: compiler.err.ref.ambiguous: u, kindname.method, <U>u(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>u(TargetType60.Sam2<U,java.lang.String>), TargetType60 11.16 +TargetType60.java:63:27: compiler.err.ref.ambiguous: u, kindname.method, <U>u(TargetType60.Sam1<U>), TargetType60, kindname.method, <U>u(TargetType60.Sam2<U,java.lang.String>), TargetType60 11.17 +7 errors