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

Wed, 14 May 2014 15:41:28 -0600

author
dlsmith
date
Wed, 14 May 2014 15:41:28 -0600
changeset 2395
9c577131ffa6
parent 0
959103a6100f
permissions
-rw-r--r--

8034223: Most-specific should not have any special treatment for boxed vs. unboxed types
Summary: Rewrite most-specific logic to conform to JLS 8 15.12.2.5
Reviewed-by: vromero

     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