fb-contrib icon indicating copy to clipboard operation
fb-contrib copied to clipboard

`FII_USE_FUNCTION_IDENTITY` false-positive

Open boris-petrov opened this issue 1 year ago • 2 comments

RxJava has its own concept of Function. And has functions that use it. We can't use java.util.Function.identity() there unfortunately. But fb-contrib gives a warning.

boris-petrov avatar Mar 01 '24 04:03 boris-petrov

can you cook up a small example?

mebigfatguy avatar Sep 28 '24 21:09 mebigfatguy

import java.util.concurrent.Callable;

import io.reactivex.rxjava3.core.Observable;
import io.reactivex.rxjava3.core.Single;

public class Test {
	public static <T> Observable<T> lazilyGetObservable(Callable<Observable<T>> callable) {
		return Single
			.fromCallable(callable)
			.flatMapObservable(observable -> observable);
	}
}

P.S. That needs the io.reactivex.rxjava3:rxjava:3.1.9 library.

boris-petrov avatar Sep 30 '24 14:09 boris-petrov

dang it.

mebigfatguy avatar Oct 06 '25 14:10 mebigfatguy