mcimadamore@1415: /* mcimadamore@1415: * @test /nodynamiccopyright/ mcimadamore@1415: * @bug 8003280 mcimadamore@1415: * @summary Add lambda tests mcimadamore@1415: * certain cases of erroneous member reference lookup are not handled by Attr.visitReference mcimadamore@1415: * @compile/fail/ref=MethodReference51.out -XDrawDiagnostics MethodReference51.java mcimadamore@1415: */ mcimadamore@1415: class MethodReference51 { mcimadamore@1415: mcimadamore@1415: private static class Foo { mcimadamore@1415: static int j(int i) { return i; } mcimadamore@1415: } mcimadamore@1415: mcimadamore@1415: static Foo foo = new Foo(); mcimadamore@1415: mcimadamore@1415: static void m(String s) { } mcimadamore@1415: static void m(Integer i) { } mcimadamore@1415: mcimadamore@1415: static int f(String s) { return 1; } mcimadamore@1415: mcimadamore@1415: static int g(Integer i, Number n) { return 1; } mcimadamore@1415: static int g(Number n, Integer i) { return 1; } mcimadamore@1415: mcimadamore@1415: int h(int i) { return i; } mcimadamore@1415: } mcimadamore@1415: mcimadamore@1415: class TestMethodReference51 { mcimadamore@1415: mcimadamore@1415: interface IntSam { mcimadamore@1415: int m(int i); mcimadamore@1415: } mcimadamore@1415: mcimadamore@1415: interface IntegerIntegerSam { mcimadamore@1415: int m(Integer i1, Integer i2); mcimadamore@1415: } mcimadamore@1415: mcimadamore@1415: mcimadamore@1415: static void test() { mcimadamore@1415: IntSam s1 = MethodReference51::unknown; //method not found mcimadamore@1415: IntSam s2 = MethodReference51::f; //inapplicable method mcimadamore@1415: IntSam s3 = MethodReference51::g; //inapplicable methods mcimadamore@1415: IntegerIntegerSam s4 = MethodReference51::g; //ambiguous mcimadamore@1415: IntSam s5 = MethodReference51::h; //static error mcimadamore@1415: IntSam s6 = MethodReference51.foo::j; //inaccessible method mcimadamore@1415: } mcimadamore@1415: }