test/tools/javac/lambda/MethodReference37.java

Tue, 12 Mar 2013 16:02:43 +0000

author
mcimadamore
date
Tue, 12 Mar 2013 16:02:43 +0000
changeset 1628
5ddecb91d843
parent 0
959103a6100f
permissions
-rw-r--r--

8009545: Graph inference: dependencies between inference variables should be set during incorporation
Summary: Move all transitivity checks into the incorporation round
Reviewed-by: jjg

     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