New behavior : java: incompatible types: inferred type does not conform to upper bound(s)

Boaz Nahum boaznahum at gmail.com
Tue Jan 1 06:34:07 PST 2013


Hi.

Old code is no longer compiled (I built lambda/lambda today 1-1-2013)

static class F<T> {}

static <T> T get(F<T> f) {return null;}
F<Integer> fi = new F<>();


double d1 = get(fi);

The last line yields

java: incompatible types: inferred type does not conform to upper bound(s)
    inferred: java.lang.Integer
    upper bound(s): java.lang.Double,java.lang.Object

Only casting solve the problem:

        double d1 = (int)get(fi);
        double d1 = (double)get(fi);


Happy new year
Boaz


More information about the lambda-dev mailing list