test/tools/javac/lambda/MethodReference70.java

changeset 1897
866c87c01285
parent 0
959103a6100f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/tools/javac/lambda/MethodReference70.java	Wed Jul 17 14:09:46 2013 +0100
     1.3 @@ -0,0 +1,28 @@
     1.4 +/*
     1.5 + * @test /nodynamiccopyright/
     1.6 + * @bug 8016175
     1.7 + * @summary Add bottom-up type-checking support for unambiguous method references
     1.8 + * @compile/fail/ref=MethodReference70.out -XDrawDiagnostics MethodReference70.java
     1.9 + */
    1.10 +class MethodReference70 {
    1.11 +    interface F<X> {
    1.12 +        void m(X x);
    1.13 +    }
    1.14 +
    1.15 +    interface G<X> {
    1.16 +        Integer m(X x);
    1.17 +    }
    1.18 +
    1.19 +    void m1(Integer i) { }
    1.20 +
    1.21 +    void m2(Integer i) { }
    1.22 +    void m2(String i) { }
    1.23 +
    1.24 +    <Z> void g(F<Z> fz) { }
    1.25 +    <Z> void g(G<Z> gz) { }
    1.26 +
    1.27 +    void test() {
    1.28 +         g(this::m1); //ok
    1.29 +         g(this::m2); //ambiguous (stuck!)
    1.30 +    }
    1.31 +}

mercurial