alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Java example source code file (T8016177b.java)

This example Java source code file (T8016177b.java) is included in the alvinalexander.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Learn more about this Java project at its project page.

Java - Java tags/keywords

function, t8016177b, tointfunction, x\,y, x\,y\,z

The T8016177b.java Java example source code

/*
 * @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 id(Function arg) { return null; }

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


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

    <X,Y,Z> X f2(Y arg, Function f) { return null; }
    <X,Y> X f2(Y arg, ToIntFunction 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
    }
}

Other Java examples (source code examples)

Here is a short list of links related to this Java T8016177b.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.