aoqi@0: /* aoqi@0: * @test /nodynamiccopyright/ aoqi@0: * @bug 8003280 aoqi@0: * @summary Add lambda tests aoqi@0: * check that non static members cannot be referenced from a method reference qualifier aoqi@0: * @author Maurizio Cimadamore aoqi@0: * @compile/fail/ref=MethodReference09.out -XDrawDiagnostics MethodReference09.java aoqi@0: */ aoqi@0: aoqi@0: class MethodReference09 { aoqi@0: interface SAM { aoqi@0: String m(Foo f); aoqi@0: } aoqi@0: aoqi@0: static class Foo { aoqi@0: String getX() { return null; } aoqi@0: aoqi@0: Foo getThis() { return this; } aoqi@0: aoqi@0: static void test() { aoqi@0: SAM s1 = Foo.getThis()::getX; aoqi@0: SAM s2 = this::getX; aoqi@0: } aoqi@0: } aoqi@0: }