test/tools/javac/lambda/8021567/T8021567.java

Tue, 10 Sep 2013 13:47:51 +0200

author
jfranck
date
Tue, 10 Sep 2013 13:47:51 +0200
changeset 2020
bb7271e64ef6
parent 0
959103a6100f
permissions
-rw-r--r--

8005222: Fixed bugs should have tests with bugid in @bug tag
Reviewed-by: jfranck, jjg
Contributed-by: Andreas Lundblad <andreas.lundblad@oracle.com>

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

mercurial