langtools/test/tools/javac/lambda/MethodReference68.java
author duke
Wed, 05 Jul 2017 23:01:50 +0200 (2017-07-05)
changeset 44228 e46434c65a2b
parent 30014 fc1f2b200c1f
permissions -rw-r--r--
Merge
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/
30014
fc1f2b200c1f 8078024: javac, several incorporation steps are silently failing when an error should be reported
vromero
parents: 18910
diff changeset
     3
 * @bug 8016175 8078024
18910
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=MethodReference68.out -XDrawDiagnostics MethodReference68.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 MethodReference68 {
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(X x);
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 getName() { 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
    @SuppressWarnings("unchecked")
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
    17
    <Z> void g(F<Z> fz, Z... zs) { }
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
    18
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
    19
    void test() {
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
    20
         g(Foo::getName);
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
    21
         g(Foo::getName, 1); //incompatible constraints, Z <: Foo, Z :> Integer
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
    22
    }
c967bfda9283 8016175: Add bottom-up type-checking support for unambiguous method references
mcimadamore
parents:
diff changeset
    23
}