test/tools/javac/lambda/MethodReference37.java

Mon, 02 Sep 2013 22:38:36 +0100

author
vromero
date
Mon, 02 Sep 2013 22:38:36 +0100
changeset 2000
4a6acc42c3a1
parent 0
959103a6100f
permissions
-rw-r--r--

8016177: structural most specific and stuckness
Reviewed-by: jjg, vromero
Contributed-by: maurizio.cimadamore@oracle.com

     1 /*
     2  * @test /nodynamiccopyright/
     3  * @bug 8003280
     4  * @summary Add lambda tests
     5  *  spurious exceptions when checking references to inner constructors where
     6  *          the enclosing class is not defined in any outer context
     7  * @compile/fail/ref=MethodReference37.out -XDrawDiagnostics MethodReference37.java
     8  */
    10 class MethodReference37 {
    12     interface SAM1<R> {
    13         R invoke();
    14     }
    16     interface SAM2<R, A> {
    17         R invoke(A a);
    18     }
    20     static class Outer {
    21         class Inner { }
    23         static void test1() {
    24             SAM2<Inner, Outer> sam = Inner::new;
    25         }
    27         void test2() {
    28             SAM1<Inner> sam0 = Inner::new;
    29             SAM2<Inner, Outer> sam1 = Inner::new;
    30         }
    31     }
    33     static void test1() {
    34         SAM2<Outer.Inner, Outer> sam = Outer.Inner::new;
    35     }
    37     void test2() {
    38         SAM2<Outer.Inner, Outer> sam1 = Outer.Inner::new;
    39     }
    40 }

mercurial