primitive type bounds
Vicente-Arturo Romero-Zaldivar
vicente.romero at oracle.com
Mon Nov 18 04:19:43 PST 2013
Hi Anna,
This is clearly a bug. I have created bug entry [1] to track it.
Thanks,
Vicente
[1] https://bugs.openjdk.java.net/browse/JDK-8028503
On 16/11/13 20:13, Anna Kozlova wrote:
> Hi,
>
>
>
> I don't understand why there is a compilation error (b. 115) here:
>
>
>
> class Test {
>
> static <U> Iterable<U> map(Mapper<String, U> mapper) {
>
> return null;
>
> }
>
>
>
> static void test() {
>
> Iterable<Integer> map = map(Test::length);
>
> }
>
>
>
> public static <T> int length(String s) {
>
> return 0;
>
> }
>
> }
>
> interface Mapper<T, U> {
>
> U map(T t);
>
> }
>
>
>
> java: incompatible types: inference variable U has incompatible bounds
>
> equality constraints: java.lang.Integer
>
> lower bounds: java.lang.Integer,int
>
>
>
> How does javac get 'int' lower bound here?
>
>
>
> Thanks,
>
> Anna
>
>
More information about the lambda-dev
mailing list