Cyclic what ?

Rémi Forax forax at
Tue Mar 15 08:34:59 PDT 2011

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 -> };

warning: thrown types cannot be inferred from lambda body because of 
cyclic inference
           return #{ t -> };
   explicit type required for the following parameter: t


More information about the lambda-dev mailing list