test/tools/javac/lambda/MethodReference09.java

Fri, 22 Mar 2013 12:43:09 +0000

author
mcimadamore
date
Fri, 22 Mar 2013 12:43:09 +0000
changeset 1655
c6728c9addff
parent 0
959103a6100f
permissions
-rw-r--r--

8010303: Graph inference: missing incorporation step causes spurious inference error
Summary: Multiple equality constraints on inference vars are not used to generate new inference constraints
Reviewed-by: jjg

     1 /*
     2  * @test /nodynamiccopyright/
     3  * @bug 8003280
     4  * @summary Add lambda tests
     5  *  check that non static members cannot be referenced from a method reference qualifier
     6  * @author  Maurizio Cimadamore
     7  * @compile/fail/ref=MethodReference09.out -XDrawDiagnostics MethodReference09.java
     8  */
    10 class MethodReference09 {
    11     interface SAM {
    12        String m(Foo f);
    13     }
    15     static class Foo<X> {
    16        String getX() { return null; }
    18        Foo<X> getThis() { return this; }
    20        static void test() {
    21           SAM s1 = Foo.getThis()::getX;
    22           SAM s2 = this::getX;
    23        }
    24     }
    25 }

mercurial