Tue, 10 Sep 2013 13:47:51 +0200
8005222: Fixed bugs should have tests with bugid in @bug tag
Reviewed-by: jfranck, jjg
Contributed-by: Andreas Lundblad <andreas.lundblad@oracle.com>
aoqi@0 | 1 | /* |
aoqi@0 | 2 | * @test /nodynamiccopyright/ |
aoqi@0 | 3 | * @bug 8023549 |
aoqi@0 | 4 | * @summary Compiler emitting spurious errors when constructor reference type is inferred and explicit type arguments are supplied |
aoqi@0 | 5 | * @compile/fail/ref=T8023549.out -XDrawDiagnostics T8023549.java |
aoqi@0 | 6 | */ |
aoqi@0 | 7 | |
aoqi@0 | 8 | public class T8023549 { |
aoqi@0 | 9 | static class Foo<X> { } |
aoqi@0 | 10 | |
aoqi@0 | 11 | interface Supplier<X> { |
aoqi@0 | 12 | X make(); |
aoqi@0 | 13 | } |
aoqi@0 | 14 | |
aoqi@0 | 15 | interface ExtSupplier<X> extends Supplier<X> { } |
aoqi@0 | 16 | |
aoqi@0 | 17 | void m1(Supplier<Foo<String>> sfs) { } |
aoqi@0 | 18 | |
aoqi@0 | 19 | void m2(Supplier<Foo<String>> sfs) { } |
aoqi@0 | 20 | void m2(ExtSupplier<Foo<Integer>> sfs) { } |
aoqi@0 | 21 | |
aoqi@0 | 22 | void test() { |
aoqi@0 | 23 | Supplier<Foo<String>> sfs = Foo::<Number>new; |
aoqi@0 | 24 | m1(Foo::<Number>new); |
aoqi@0 | 25 | m2(Foo::<Number>new); |
aoqi@0 | 26 | } |
aoqi@0 | 27 | } |