mcimadamore@1415: /* vromero@2015: * @test /nodynamiccopyright/ mcimadamore@1415: * @bug 8003280 mcimadamore@1415: * @summary Add lambda tests mcimadamore@1415: * check that raw qualifier in unbound method reference is inferred from descriptor vromero@2000: * @compile/fail/ref=MethodReference48.out -XDrawDiagnostics MethodReference48.java mcimadamore@1415: */ vromero@2015: mcimadamore@1415: public class MethodReference48 { mcimadamore@1415: mcimadamore@1415: static class Foo { mcimadamore@1415: X m() { return null; }; mcimadamore@1415: } mcimadamore@1415: mcimadamore@1415: interface SAM1 { mcimadamore@1415: Foo m(Foo fs); mcimadamore@1415: } mcimadamore@1415: mcimadamore@1415: interface SAM2 { mcimadamore@1415: Integer m(Foo fi); mcimadamore@1415: } mcimadamore@1415: mcimadamore@1415: interface SAM3 { mcimadamore@1415: Object m(Foo fi); mcimadamore@1415: } mcimadamore@1415: vromero@2000: static void g1(SAM1 s) { } //return type not compatible vromero@2000: vromero@2000: static void g2(SAM2 s) { } //ok vromero@2000: vromero@2000: static void g3(SAM3 s) { } //ok vromero@2000: vromero@2000: static void g4(SAM1 s) { } //return type not compatible vromero@2000: static void g4(SAM2 s) { } //ok vromero@2000: static void g4(SAM3 s) { } //ok mcimadamore@1415: mcimadamore@1415: public static void main(String[] args) { vromero@2000: g1(Foo::m); vromero@2000: g2(Foo::m); vromero@2000: g3(Foo::m); vromero@2000: g4(Foo::m); mcimadamore@1415: } mcimadamore@1415: }