test/tools/javac/lambda/TargetType16.java

Thu, 06 Jun 2013 15:33:40 +0100

author
mcimadamore
date
Thu, 06 Jun 2013 15:33:40 +0100
changeset 1811
349160289ba2
parent 1415
01c9d4161882
child 2395
9c577131ffa6
permissions
-rw-r--r--

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 8003280
     4  * @summary Add lambda tests
     5  *  Check void-compatibility in strict vs. loose conversion contexts
     6  * @compile/fail/ref=TargetType16.out -XDrawDiagnostics TargetType16.java
     7  */
     9 class TargetType16 {
    11     interface SAM1 {
    12         void m1();
    13     }
    15     interface SAM2<X> {
    16         X m2();
    17     }
    19     static void m(SAM1 s1) { }
    20     static <T> void m(SAM2<T> s2) { }
    22     public static void main(String[] args) {
    23         m(() -> { throw new AssertionError(); }); //ambiguous
    24     }
    25 }

mercurial