langtools/test/tools/javac/lambda/MethodReference69.java
author mcimadamore
Wed, 17 Jul 2013 14:09:46 +0100
changeset 18910 c967bfda9283
permissions -rw-r--r--
8016175: Add bottom-up type-checking support for unambiguous method references Summary: Type-checking of non-overloaded method references should be independent from target-type Reviewed-by: jjg, vromero
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
18910
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
     1
/*
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
     2
 * @test /nodynamiccopyright/
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
     3
 * @bug 8016175
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
     4
 * @summary Add bottom-up type-checking support for unambiguous method references
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
     5
 * @compile/fail/ref=MethodReference69.out -XDrawDiagnostics MethodReference69.java
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
     6
 */
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
     7
class MethodReference69 {
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
     8
    interface F<X> {
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
     9
        String m(Integer x1, X x2);
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
    10
    }
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
    11
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
    12
    static class Foo {
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
    13
        String getNameAt(Integer i) { return ""; }
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
    14
    }
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
    15
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
    16
    <Z> void g(F<Z> fz) { }
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
    17
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
    18
    void test() {
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
    19
         g(Foo::getName);
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
    20
    }
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
    21
}