The JSpecify JDK model for Optional.orElseGet is (here):
// We would use an annotation like @PolyNull here if JSpecify offered one.
public @Nullable T orElseGet(Supplier<? extends @Nullable T> supplier) {
When working on #1613 I noticed that modeling orElseGet as returning @Nullable introduces many false positives, for cases where the provided supplier cannot return null. I think we probably need to find a way to model this one precisely in order to not cause too many FPs in practice.
The JSpecify JDK model for
Optional.orElseGetis (here):When working on #1613 I noticed that modeling
orElseGetas returning@Nullableintroduces many false positives, for cases where the providedsuppliercannot returnnull. I think we probably need to find a way to model this one precisely in order to not cause too many FPs in practice.