This program
import java.util.function.Function;
interface C<A> { }
interface S<T> {
<A> A m1(C<A> c);
}
public abstract class X {
void foo2(S<String> s) {
s.m1(m2(String::toUpperCase, xyz -> "NODATA"));
}
public abstract <T, K, U>
C<?> m2(Function<? super T, ? extends K> keyMapper,
Function<? super T, ? extends U> valueMapper);
}
triggers these errors:
----------\n
1. ERROR in X.java (at line 8)\n
s.m1(m2(String::toUpperCase, xyz -> "NODATA"));\n
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n
Problem detected during type inference: Unknown error at invocation of m2(Function<? super Object,? extends Object>, Function<? super Object,? extends Object>)\n
----------\n
2. ERROR in X.java (at line 8)\n
s.m1(m2(String::toUpperCase, xyz -> "NODATA"));\n
^^^^^^^^^^^^^^^^^^^\n
The type String does not define toUpperCase(Object) that is applicable here\n
----------\n
The first message should of course never be seen.
This program
triggers these errors:
The first message should of course never be seen.