langtools/test/tools/javac/lambda/MethodReference37.java
author vromero
Wed, 23 Jan 2013 20:57:40 +0000
changeset 15384 5a8d00abf076
parent 14547 86d8d242b0c4
child 30998 9e8f3b991f97
permissions -rw-r--r--
8006694: temporarily workaround combo tests are causing time out in several platforms Reviewed-by: jjg Contributed-by: maurizio.cimadamore@oracle.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14547
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     1
/*
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     2
 * @test /nodynamiccopyright/
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     3
 * @bug 8003280
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     4
 * @summary Add lambda tests
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     5
 *  spurious exceptions when checking references to inner constructors where
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     6
 *          the enclosing class is not defined in any outer context
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     7
 * @compile/fail/ref=MethodReference37.out -XDrawDiagnostics MethodReference37.java
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     8
 */
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
     9
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    10
class MethodReference37 {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    11
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    12
    interface SAM1<R> {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    13
        R invoke();
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    14
    }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    15
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    16
    interface SAM2<R, A> {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    17
        R invoke(A a);
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    18
    }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    19
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    20
    static class Outer {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    21
        class Inner { }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    22
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    23
        static void test1() {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    24
            SAM2<Inner, Outer> sam = Inner::new;
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    25
        }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    26
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    27
        void test2() {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    28
            SAM1<Inner> sam0 = Inner::new;
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    29
            SAM2<Inner, Outer> sam1 = Inner::new;
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    30
        }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    31
    }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    32
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    33
    static void test1() {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    34
        SAM2<Outer.Inner, Outer> sam = Outer.Inner::new;
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    35
    }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    36
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    37
    void test2() {
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    38
        SAM2<Outer.Inner, Outer> sam1 = Outer.Inner::new;
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    39
    }
86d8d242b0c4 8003280: Add lambda tests
mcimadamore
parents:
diff changeset
    40
}