Open msridhar opened 1 month ago
Couple of quick observations here.
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java:333: warning: [NullAway] passing @Nullable parameter 'this.executor' where @NonNull is required
requireState(this.executor == null, "executor was already set to %s", this.executor);
This is a false positive due to #674. I should re-prioritize that one and try to fix it soon (though it's a bit messy).
Generally we've tried to specifically look for org.jspecify.annotations.Nullable
annotations in certain places for now. It looks like Caffeine is using Checker Framework's @Nullable
. @ben-manes any plan to transition to JSpecify annotations? If not we can look into broadening JSpecify mode to also recognize other type-use @Nullable
annotations.
/Users/ben/projects/caffeine/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncCache.java:444: warning: [NullAway] Writing @Nullable expression into array with @NonNull contents.
result[0] = (oldValue == null) ? null : remappingFunction.apply(k, oldValue);
To me this looks like a real issue. With JSpecify semantics, I would expect the result
variable to be declared as @Nullable CompletableFuture<V>[] result
, to allow for the array to contain null values. I'd also expect the enclosing method's return type to be @Nullable CompletableFuture<V>
. @ben-manes does that sound right to you?
This is a false positive due to https://github.com/uber/NullAway/issues/674.
It is expected that this would show up only when JSpecify mode is enabled or it just dumb luck?
any plan to transition to JSpecify annotations?
I am planning on mirroring Guava and migrate when they have. That's mostly because the previous annotation discussions are a lot of bike shedding that I don't enjoy (maven dependency scope, stylistic semantics, etc). Pushing those who like to argue towards Guava helps me close the issues and say that I'll follow whatever best practices the broader community chooses. Hopefully they make the transition soon with 1.0 released (congrats!) so I'll do a fast follow.
To me this looks like a real issue.
That seems reasonable to me.
This is a false positive due to https://github.com/uber/NullAway/issues/674.
It is expected that this would show up only when JSpecify mode is enabled or it just dumb luck?
I think our current hacks make things work outside JSpecify mode. I'm not exactly sure why they don't work in JSpecify mode; you're right that might be a separate issue from #674.