|
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 */ |
|
9 |
|
10 class MethodReference37 { |
|
11 |
|
12 interface SAM1<R> { |
|
13 R invoke(); |
|
14 } |
|
15 |
|
16 interface SAM2<R, A> { |
|
17 R invoke(A a); |
|
18 } |
|
19 |
|
20 static class Outer { |
|
21 class Inner { } |
|
22 |
|
23 static void test1() { |
|
24 SAM2<Inner, Outer> sam = Inner::new; |
|
25 } |
|
26 |
|
27 void test2() { |
|
28 SAM1<Inner> sam0 = Inner::new; |
|
29 SAM2<Inner, Outer> sam1 = Inner::new; |
|
30 } |
|
31 } |
|
32 |
|
33 static void test1() { |
|
34 SAM2<Outer.Inner, Outer> sam = Outer.Inner::new; |
|
35 } |
|
36 |
|
37 void test2() { |
|
38 SAM2<Outer.Inner, Outer> sam1 = Outer.Inner::new; |
|
39 } |
|
40 } |