diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AsyncCacheLoader.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AsyncCacheLoader.java index 745922807a..8abff8d7e1 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AsyncCacheLoader.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AsyncCacheLoader.java @@ -25,6 +25,7 @@ import java.util.function.Function; import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; /** * Computes or retrieves values asynchronously based on a key, for use in populating a @@ -62,7 +63,7 @@ public interface AsyncCacheLoader { * treated like any other {@code Exception} in all respects except that, when it is * caught, the thread's interrupt status is set */ - CompletableFuture asyncLoad(K key, Executor executor) throws Exception; + CompletableFuture asyncLoad(K key, Executor executor) throws Exception; /** * Asynchronously computes or retrieves the values corresponding to {@code keys}. This method is @@ -114,7 +115,7 @@ public interface AsyncCacheLoader { * treated like any other {@code Exception} in all respects except that, when it is * caught, the thread's interrupt status is set */ - default CompletableFuture asyncReload( + default CompletableFuture asyncReload( K key, V oldValue, Executor executor) throws Exception { return asyncLoad(key, executor); } diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/CacheLoader.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/CacheLoader.java index 217c81a868..3d8b9ca642 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/CacheLoader.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/CacheLoader.java @@ -101,7 +101,7 @@ public interface CacheLoader extends AsyncCacheLoader { * @return the future value associated with {@code key} */ @Override - default CompletableFuture asyncLoad(K key, Executor executor) throws Exception { + default CompletableFuture asyncLoad(K key, Executor executor) throws Exception { requireNonNull(key); requireNonNull(executor); return CompletableFuture.supplyAsync(() -> { @@ -193,7 +193,7 @@ default CompletableFuture asyncLoad(K key, Executor executor) throw * {@code null} if the mapping is to be removed */ @Override - default CompletableFuture asyncReload( + default CompletableFuture asyncReload( K key, V oldValue, Executor executor) throws Exception { requireNonNull(key); requireNonNull(executor);