Thu, 10 Oct 2013 14:58:04 +0200
8001931: The new build system whitespace cleanup
Reviewed-by: tbell, simonis, erikj
1 /*
2 * @test /nodynamiccopyright/
3 * @bug 8008540 8008539 8008538
4 * @summary Constructor reference to non-reifiable array should be rejected
5 * @compile/fail/ref=MethodReference64.out -XDrawDiagnostics MethodReference64.java
6 */
7 class MethodReference64 {
8 interface ClassFactory {
9 Object m();
10 }
12 interface ArrayFactory {
13 Object m(int i);
14 }
16 @interface Anno { }
18 enum E { }
20 interface I { }
22 static class Foo<X> { }
24 void m(ClassFactory cf) { }
25 void m(ArrayFactory cf) { }
27 void testAssign() {
28 ClassFactory c1 = Anno::new; //error
29 ClassFactory c2 = E::new; //error
30 ClassFactory c3 = I::new; //error
31 ClassFactory c4 = Foo<?>::new; //error
32 ClassFactory c5 = 1::new; //error
33 ArrayFactory a1 = Foo<?>[]::new; //ok
34 ArrayFactory a2 = Foo<? extends String>[]::new; //error
35 }
37 void testMethod() {
38 m(Anno::new); //error
39 m(E::new); //error
40 m(I::new); //error
41 m(Foo<?>::new); //error
42 m(1::new); //error
43 m(Foo<?>[]::new); //ok - resolves to m(ArrayFactory)
44 m(Foo<? extends String>[]::new); //error
45 }
46 }