Skip to content

Commit

Permalink
Unmark *LoadingCache result types.
Browse files Browse the repository at this point in the history
  • Loading branch information
cpovirk committed Dec 4, 2024
1 parent bc74eb6 commit d9235d3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
import java.util.Map;
import java.util.concurrent.CompletableFuture;

import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.NullUnmarked;

/**
* A semi-persistent mapping from keys to values. Values are automatically loaded by the cache
Expand Down Expand Up @@ -50,7 +52,8 @@ public interface AsyncLoadingCache<K, V> extends AsyncCache<K, V> {
* @throws RuntimeException or Error if the {@link AsyncCacheLoader} does when constructing the
* future, in which case the mapping is left unestablished
*/
CompletableFuture<V> get(K key);
@NullUnmarked
@NonNull CompletableFuture<V> get(@NonNull K key);

/**
* Returns the future of a map of the values associated with {@code keys}, creating or retrieving
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;

import org.jspecify.annotations.NonNull;
import org.jspecify.annotations.NullMarked;
import org.jspecify.annotations.NullUnmarked;

import com.google.errorprone.annotations.CanIgnoreReturnValue;

Expand Down Expand Up @@ -62,7 +64,8 @@ public interface LoadingCache<K, V> extends Cache<K, V> {
* @throws RuntimeException or Error if the {@link CacheLoader} does so, in which case the mapping
* is left unestablished
*/
V get(K key);
@NullUnmarked
V get(@NonNull K key);

/**
* Returns a map of the values associated with the {@code keys}, creating or retrieving those
Expand Down Expand Up @@ -110,7 +113,8 @@ public interface LoadingCache<K, V> extends Cache<K, V> {
* @throws NullPointerException if the specified key is null
*/
@CanIgnoreReturnValue
CompletableFuture<V> refresh(K key);
@NullUnmarked
@NonNull CompletableFuture<V> refresh(@NonNull K key);

/**
* Loads a new value for each {@code key}, asynchronously. While the new value is loading the
Expand Down

0 comments on commit d9235d3

Please sign in to comment.