| 1 |
import java.util.function.*; |
| 2 |
import java.util.stream.*; |
| 3 |
import org.checkerframework.checker.nullness.qual.*; |
| 4 |
|
| 5 |
// @skip-test |
| 6 |
public class Issue1954 { |
| 7 |
public interface Getter<R> { |
| 8 |
R get(); |
| 9 |
} |
| 10 |
|
| 11 |
public interface NullStringGetter extends Getter<@Nullable String> {} |
| 12 |
|
| 13 |
public <T, R> Getter<R> transform(Function<Stream<T>, R> fn, Getter<T> getter) { |
| 14 |
return () -> fn.apply(Stream.of(getter.get())); |
| 15 |
} |
| 16 |
|
| 17 |
public static <T> @Nullable T fn(Stream<T> arg) { |
| 18 |
return arg.findFirst().orElse(null); |
| 19 |
} |
| 20 |
|
| 21 |
public void doo() { |
| 22 |
NullStringGetter nullStringGetter = () -> null; |
| 23 |
// :: error: type inference failed. |
| 24 |
transform(Issue1954::fn, nullStringGetter).get(); |
| 25 |
} |
| 26 |
} |