Cyclic what ?
Rémi Forax
forax at univ-mlv.fr
Tue Mar 15 08:34:59 PDT 2011
Maurizio,
This snippet emit a warning.
I don't understand why it doesn't just compile and why it emit a warning
and not an error.
public interface Mapper<T, U> {
public U map(T t);
}
public static <T,U,V> Mapper<T,V> compose(Mapper<? super T, ? extends
U> mapper1,
Mapper<? super U, ? extends V> mapper2) {
return #{ t -> mapper2.map(mapper1.map(t)) };
}
warning: thrown types cannot be inferred from lambda body because of
cyclic inference
return #{ t -> mapper2.map(mapper1.map(t)) };
^
explicit type required for the following parameter: t
Rémi
More information about the lambda-dev
mailing list