class B<T> {} 

public class Test { 
static B<Integer> fn(B<Object> a) { return null; } 

public static void main(String[] args) { 

                Optional<B> opt = Optional.empty(); // note raw type parameter B 

                B<Integer> res = opt.map(Test::fn).get(); // COMPILE ERROR: incompatible types: Object cannot be converted to B<Integer> 

} 
} 