Mon, 21 Jan 2013 11:16:28 -0800
Merge
1 /*
2 * @test /nodynamiccopyright/
3 * @bug 8003280
4 * @summary Add lambda tests
5 * certain cases of erroneous member reference lookup are not handled by Attr.visitReference
6 * @compile/fail/ref=MethodReference51.out -XDrawDiagnostics MethodReference51.java
7 */
8 class MethodReference51 {
10 private static class Foo {
11 static int j(int i) { return i; }
12 }
14 static Foo foo = new Foo();
16 static void m(String s) { }
17 static void m(Integer i) { }
19 static int f(String s) { return 1; }
21 static int g(Integer i, Number n) { return 1; }
22 static int g(Number n, Integer i) { return 1; }
24 int h(int i) { return i; }
25 }
27 class TestMethodReference51 {
29 interface IntSam {
30 int m(int i);
31 }
33 interface IntegerIntegerSam {
34 int m(Integer i1, Integer i2);
35 }
38 static void test() {
39 IntSam s1 = MethodReference51::unknown; //method not found
40 IntSam s2 = MethodReference51::f; //inapplicable method
41 IntSam s3 = MethodReference51::g; //inapplicable methods
42 IntegerIntegerSam s4 = MethodReference51::g; //ambiguous
43 IntSam s5 = MethodReference51::h; //static error
44 IntSam s6 = MethodReference51.foo::j; //inaccessible method
45 }
46 }