gradle-retrolambda
gradle-retrolambda copied to clipboard
Error with explicit generic casts
If an explicit generic cast is used it is not caught by retrolambda and generated lambda parameter uses Object instead of type provided by generic.
For example in this valid java code using io.reactivex:rxjava and com.trello:rxlifecycle an explicit cast is needed in obs.<Pair>
LifecycleProvider lifecycleProvider = null;
Observable<Pair> obs = Observable.just(new Pair(1,2));
obs.<Pair>compose(lifecycleProvider.bindToLifecycle())
.map(v -> v.first)
.subscribe(v -> Timber.v("%s",v));
This, to my understand, is valid java code but when compiled with retrolambda doesn't compile because v is an object (as is the casting hasn't been made)
PD: I know that casting can be eliminated by providng a generic qualifier in lifecycleProvider declaration. But in any case I think that is valid Java code that doesn't compile with retrolambda.