File: T8016177b.java

package info (click to toggle)
libnb-javaparser-java 9%2B2018-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 65,320 kB
  • sloc: java: 440,096; xml: 6,359; sh: 865; makefile: 314
file content (34 lines) | stat: -rw-r--r-- 873 bytes parent folder | download | duplicates (18)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/*
 * @test /nodynamiccopyright/
 * @bug 8016177 8016178
 * @summary structural most specific and stuckness
 * @compile/fail/ref=T8016177b.out -XDrawDiagnostics T8016177b.java
 */
class T8016177b {
    interface ToIntFunction<X> {
        int m(X x);
    }

    interface Function<X, Y> {
        Y m(X x);
    }

    <U, V> Function<U, V> id(Function<U, V> arg) { return null; }

    <U, V> Function<U, V> id2(Function<U, V> arg) { return null; }
    <U> ToIntFunction<U> id2(ToIntFunction<U> arg) { return null; }


    <X,Y,Z> X f(Y arg, Function<Y, Z> f) { return null; }

    <X,Y,Z> X f2(Y arg, Function<Y, Z> f) { return null; }
    <X,Y> X f2(Y arg, ToIntFunction<Y> f) { return null; }

    <T> T g(T arg) { return null; }

    void test() {
        g(f("hi", id(x->1))); //ok
        g(f("hi", id2(x->1))); //ambiguous
        g(f2("hi", id(x->1))); //ok
    }
}