Fri, 05 Jul 2013 11:04:22 +0100
8016702: use of ternary operator in lambda expression gives incorrect results
Summary: Constant types erroneously creep in during inference
Reviewed-by: jjg, vromero
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 }