Thu, 06 Jun 2013 15:33:40 +0100
8008627: Compiler mishandles three-way return-type-substitutability
Summary: Compiler should not enforce an order in how ambiguous methods should be resolved
Reviewed-by: jjg, vromero
1 /*
2 * @test /nodynamiccopyright/
3 * @bug 7188968
4 *
5 * @summary Diamond: javac generates diamond inference errors when in 'finder' mode
6 * @author mcimadamore
7 * @compile/fail/ref=T7188968.out -Xlint:unchecked -XDrawDiagnostics T7188968.java
8 *
9 */
10 import java.util.List;
12 class T7188968 {
14 static class Foo<X> {
15 Foo(List<X> ls, Object o) { }
16 static <Z> Foo<Z> makeFoo(List<Z> lz, Object o) { return null; }
17 }
19 void test(List l) {
20 new Foo(l, unknown);
21 new Foo(l, unknown) { };
22 new Foo<>(l, unknown);
23 Foo.makeFoo(l, unknown);
24 }
25 }