rewrite-static-analysis
rewrite-static-analysis copied to clipboard
Unnecessary explicit type arguments removes necessary type arguments
In the following sample the type arugment <String>
is remove. But this is required by the .map(this::mapper)
public class Test {
void test(){
Stream.of("hi")
.map(it -> it == null ? Optional.<String>empty() : Optional.of(it))
.flatMap(Optional::stream)
.map(this::mapper);
}
Optional<String> mapper(String value){
return Optional.ofNullable(value)
.filter("hi"::equals);
}
}