Skip to content

Commit

Permalink
Make function output types nullable instead of unspecified.
Browse files Browse the repository at this point in the history
  • Loading branch information
cpovirk committed Dec 3, 2024
1 parent 41d97e6 commit e9e5013
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public interface AsyncCache<K, V> {
*/
@NullUnmarked
@NonNull CompletableFuture<V> get(
@NonNull K key, @NonNull Function<? super @NonNull K, ? extends V> mappingFunction);
@NonNull K key, @NonNull Function<? super @NonNull K, ? extends @Nullable V> mappingFunction);

/**
* Returns the future associated with the {@code key} in this cache, obtaining that value from
Expand All @@ -95,10 +95,10 @@ public interface AsyncCache<K, V> {
* @param mappingFunction the function to asynchronously compute a value, optionally using the
* given executor
* @return the current (existing or computed) future value associated with the specified key
* @throws NullPointerException if the specified key or mappingFunction is null, or if the future
* returned by the mappingFunction is null
* @throws RuntimeException or Error if the mappingFunction does when constructing the future, in
* which case the mapping is left unestablished
* @throws NullPointerException if the specified key or mappingFunction is null, or if the
* future returned by the mappingFunction is null
* @throws RuntimeException or Error if the mappingFunction does when constructing the future,
* in which case the mapping is left unestablished
*/
@NullUnmarked
@NonNull CompletableFuture<V> get(
Expand All @@ -107,7 +107,7 @@ public interface AsyncCache<K, V> {
BiFunction<
? super @NonNull K,
? super @NonNull Executor,
? extends @NonNull CompletableFuture<? extends V>>
? extends @NonNull CompletableFuture<? extends @Nullable V>>
mappingFunction);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public interface Cache<K, V> {
* left unestablished
*/
@NullUnmarked
V get(@NonNull K key, Function<? super @NonNull K, ? extends V> mappingFunction);
V get(@NonNull K key, Function<? super @NonNull K, ? extends @Nullable V> mappingFunction);

/**
* Returns a map of the values associated with the {@code keys} in this cache. The returned map
Expand Down

0 comments on commit e9e5013

Please sign in to comment.