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 8021567 |
aoqi@0 | 4 | * @summary Javac doesn't report "java: reference to method is ambiguous" any more |
aoqi@0 | 5 | * @compile/fail/ref=T8021567.out -XDrawDiagnostics T8021567.java |
aoqi@0 | 6 | */ |
aoqi@0 | 7 | |
aoqi@0 | 8 | class T8021567 { |
aoqi@0 | 9 | |
aoqi@0 | 10 | interface I_int { int m(); } |
aoqi@0 | 11 | |
aoqi@0 | 12 | interface I_char { char m(); } |
aoqi@0 | 13 | |
aoqi@0 | 14 | interface I_byte { byte m(); } |
aoqi@0 | 15 | |
aoqi@0 | 16 | void m(I_byte b) { } |
aoqi@0 | 17 | void m(I_char b) { } |
aoqi@0 | 18 | void m(I_int b) { } |
aoqi@0 | 19 | |
aoqi@0 | 20 | void test() { |
aoqi@0 | 21 | m(() -> 1); //ambiguous |
aoqi@0 | 22 | m(() -> 256); //ok - only method(I_int) applicable |
aoqi@0 | 23 | m(() -> { int i = 1; return i; }); //ok - only method(I_int) applicable |
aoqi@0 | 24 | m(() -> { int i = 256; return i; }); //ok - only method(I_int) applicable |
aoqi@0 | 25 | } |
aoqi@0 | 26 | } |