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