blob: 70a6e70c310c8f6669e4c3a830909a8adbca842b [file] [log] [blame]
class A {
private interface AsyncFunction<I, O> {
Promise<O> apply(I input);
}
private interface Function<I, O> {
O apply(I input);
}
private interface Promise<V> {
<T1> Promise<T1> then(Function<? super V, T1> function);
<T2> Promise<T2> then(AsyncFunction<? super V, T2> function);
}
private static Promise<Integer> calculateLength(String word) {
return null;
}
public static void main(Promise<String> helloWorld) {
helloWorld.then(A::calculateLength);
}
}
class AAmbiguous {
private interface AsyncFunction<I, O> {
O apply(I input);
}
private interface Function<I, O> {
O apply(I input);
}
private interface Promise<V> {
<T1> Promise<T1> then(Function<? super V, T1> function);
<T2> Promise<T2> then(AsyncFunction<? super V, T2> function);
}
private static Promise<Integer> calculateLength(String word) {
return null;
}
public static void main(Promise<String> helloWorld) {
helloWorld.then<error descr="Ambiguous method call: both 'Promise.then(Function<? super String, Promise<Integer>>)' and 'Promise.then(AsyncFunction<? super String, Promise<Integer>>)' match">(AAmbiguous::calculateLength)</error>;
}
}