diff --git a/caffeine/build.gradle.kts b/caffeine/build.gradle.kts index 33c99a2d34..0fe16e2c77 100644 --- a/caffeine/build.gradle.kts +++ b/caffeine/build.gradle.kts @@ -29,7 +29,7 @@ val javaPoetRuntimeOnly: Configuration = configurations["javaPoetRuntimeOnly"] val javaPoetImplementation: Configuration = configurations["javaPoetImplementation"] dependencies { - api(libs.checker.annotations) + api(libs.jspecify) api(libs.errorprone.annotations) testImplementation(libs.joor) @@ -75,6 +75,7 @@ dependencies { javaPoetImplementation(libs.guava) javaPoetImplementation(libs.javapoet) + javaPoetImplementation(libs.jspecify) javaPoetImplementation(libs.commons.lang3) javaPoetRuntimeOnly(libs.google.java.format) diff --git a/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/Specifications.java b/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/Specifications.java index 3c770e0932..8305fbf5dd 100644 --- a/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/Specifications.java +++ b/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/Specifications.java @@ -20,7 +20,7 @@ import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.squareup.javapoet.ClassName; import com.squareup.javapoet.ParameterSpec; diff --git a/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/local/package-info.java b/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/local/package-info.java index 5c5a45b927..f651d881b1 100644 --- a/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/local/package-info.java +++ b/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/local/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.local; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/node/package-info.java b/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/node/package-info.java index f20678411b..dfe66c8b7a 100644 --- a/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/node/package-info.java +++ b/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/node/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.node; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/package-info.java b/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/package-info.java index 6a536374b0..a00ec4f1f7 100644 --- a/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/package-info.java +++ b/caffeine/src/javaPoet/java/com/github/benmanes/caffeine/cache/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/jmh/java/com/github/benmanes/caffeine/DelegationBenchmark.java b/caffeine/src/jmh/java/com/github/benmanes/caffeine/DelegationBenchmark.java index 15dc7d81e1..de30af8889 100644 --- a/caffeine/src/jmh/java/com/github/benmanes/caffeine/DelegationBenchmark.java +++ b/caffeine/src/jmh/java/com/github/benmanes/caffeine/DelegationBenchmark.java @@ -19,7 +19,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ThreadLocalRandom; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; diff --git a/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/BasicCache.java b/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/BasicCache.java index d65f20dcc8..5418d88343 100644 --- a/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/BasicCache.java +++ b/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/BasicCache.java @@ -15,7 +15,7 @@ */ package com.github.benmanes.caffeine.cache; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; /** * A facade for benchmark implementations. diff --git a/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/TimerWheelBenchmark.java b/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/TimerWheelBenchmark.java index 209e1f71b2..aa113f23fa 100644 --- a/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/TimerWheelBenchmark.java +++ b/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/TimerWheelBenchmark.java @@ -19,7 +19,7 @@ import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.TimeUnit; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.Scope; import org.openjdk.jmh.annotations.Setup; diff --git a/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/impl/package-info.java b/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/impl/package-info.java index 763f9fa0c5..440483b94d 100644 --- a/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/impl/package-info.java +++ b/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/impl/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.impl; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/package-info.java b/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/package-info.java index 6a536374b0..a00ec4f1f7 100644 --- a/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/package-info.java +++ b/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/sketch/CountMinSketch.java b/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/sketch/CountMinSketch.java index 49db9d33c8..c62f8f731d 100644 --- a/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/sketch/CountMinSketch.java +++ b/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/sketch/CountMinSketch.java @@ -17,8 +17,6 @@ import static com.google.common.base.Preconditions.checkArgument; -import org.checkerframework.checker.index.qual.NonNegative; - import com.google.common.math.IntMath; /** @@ -77,7 +75,7 @@ public CountMinSketch() {} * * @param maximumSize the maximum size of the cache */ - public void ensureCapacity(@NonNegative long maximumSize) { + public void ensureCapacity(long maximumSize) { checkArgument(maximumSize >= 0); int maximum = (int) Math.min(maximumSize, Integer.MAX_VALUE >>> 1); if ((table != null) && (table.length >= maximum)) { @@ -107,7 +105,7 @@ public boolean isNotInitialized() { * @param e the element to count occurrences of * @return the estimated number of occurrences of the element; possibly zero but never negative */ - public @NonNegative int frequency(E e) { + public int frequency(E e) { if (isNotInitialized()) { return 0; } diff --git a/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/sketch/package-info.java b/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/sketch/package-info.java index 0f23542b7b..bb53977942 100644 --- a/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/sketch/package-info.java +++ b/caffeine/src/jmh/java/com/github/benmanes/caffeine/cache/sketch/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.sketch; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/jmh/java/com/github/benmanes/caffeine/package-info.java b/caffeine/src/jmh/java/com/github/benmanes/caffeine/package-info.java index 7e490e3225..3339cf3563 100644 --- a/caffeine/src/jmh/java/com/github/benmanes/caffeine/package-info.java +++ b/caffeine/src/jmh/java/com/github/benmanes/caffeine/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/jmh/java/com/github/benmanes/caffeine/profiler/package-info.java b/caffeine/src/jmh/java/com/github/benmanes/caffeine/profiler/package-info.java index 10dffd255c..aafe8e615e 100644 --- a/caffeine/src/jmh/java/com/github/benmanes/caffeine/profiler/package-info.java +++ b/caffeine/src/jmh/java/com/github/benmanes/caffeine/profiler/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.profiler; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AbstractLinkedDeque.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AbstractLinkedDeque.java index ee2b250633..ee29d30648 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AbstractLinkedDeque.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AbstractLinkedDeque.java @@ -20,7 +20,7 @@ import java.util.ConcurrentModificationException; import java.util.NoSuchElementException; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.google.errorprone.annotations.Var; diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AccessOrderDeque.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AccessOrderDeque.java index 45c5b72eb1..93d34a6faf 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AccessOrderDeque.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AccessOrderDeque.java @@ -17,7 +17,7 @@ import java.util.Deque; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.AccessOrderDeque.AccessOrder; diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Async.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Async.java index c4f7e81aee..331d588e78 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Async.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Async.java @@ -26,7 +26,7 @@ import java.util.concurrent.CompletionException; import java.util.concurrent.Executor; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; /** * Static utility methods and classes pertaining to asynchronous operations. diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AsyncCache.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AsyncCache.java index 6fd3e1174d..a7e5d37af0 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AsyncCache.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AsyncCache.java @@ -23,7 +23,8 @@ import java.util.function.BiFunction; import java.util.function.Function; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; /** * A semi-persistent mapping from keys to values. Cache entries are manually added using @@ -37,6 +38,7 @@ * @param the type of keys maintained by this cache * @param the type of mapped values */ +@NullMarked public interface AsyncCache { /** 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 b2c0948611..745922807a 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 @@ -24,6 +24,8 @@ import java.util.function.BiFunction; import java.util.function.Function; +import org.jspecify.annotations.NullMarked; + /** * Computes or retrieves values asynchronously based on a key, for use in populating a * {@link AsyncLoadingCache}. @@ -42,6 +44,7 @@ * @param the type of values * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked @FunctionalInterface @SuppressWarnings("PMD.SignatureDeclareThrowsException") public interface AsyncCacheLoader { diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AsyncLoadingCache.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AsyncLoadingCache.java index ee1eb9357c..8b60c3168d 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AsyncLoadingCache.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/AsyncLoadingCache.java @@ -18,6 +18,8 @@ import java.util.Map; import java.util.concurrent.CompletableFuture; +import org.jspecify.annotations.NullMarked; + /** * A semi-persistent mapping from keys to values. Values are automatically loaded by the cache * asynchronously and are stored in the cache until either evicted or manually invalidated. @@ -29,6 +31,7 @@ * @param the type of keys maintained by this cache * @param the type of mapped values */ +@NullMarked public interface AsyncLoadingCache extends AsyncCache { /** diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java index a1e5129148..a588512dd9 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/BoundedLocalCache.java @@ -83,7 +83,7 @@ import java.util.stream.Stream; import java.util.stream.StreamSupport; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.Async.AsyncExpiry; import com.github.benmanes.caffeine.cache.LinkedDeque.PeekingIterator; @@ -3011,7 +3011,7 @@ public Set> entrySet() { * {@link #size()} as many usages assume it to be instantaneous and lock-free. */ @Override - public boolean equals(Object o) { + public boolean equals(@Nullable Object o) { if (o == this) { return true; } else if (!(o instanceof Map)) { @@ -3090,7 +3090,7 @@ public String toString() { * @return the computed value */ @SuppressWarnings("GuardedByChecker") - T evictionOrder(boolean hottest, Function transformer, + T evictionOrder(boolean hottest, Function<@Nullable V, @Nullable V> transformer, Function>, T> mappingFunction) { Comparator> comparator = Comparator.comparingInt(node -> { K key = node.getKey(); @@ -3125,7 +3125,7 @@ T evictionOrder(boolean hottest, Function transformer, * @return the computed value */ @SuppressWarnings("GuardedByChecker") - T expireAfterAccessOrder(boolean oldest, Function transformer, + T expireAfterAccessOrder(boolean oldest, Function<@Nullable V, @Nullable V> transformer, Function>, T> mappingFunction) { Iterable> iterable; if (evicts()) { @@ -3163,7 +3163,7 @@ T expireAfterAccessOrder(boolean oldest, Function transformer, * @param mappingFunction the mapping function to compute a value * @return the computed value */ - T snapshot(Iterable> iterable, Function transformer, + T snapshot(Iterable> iterable, Function<@Nullable V, @Nullable V> transformer, Function>, T> mappingFunction) { requireNonNull(mappingFunction); requireNonNull(transformer); @@ -3865,7 +3865,7 @@ public int characteristics() { } /** A reusable task that performs the maintenance work; used to avoid wrapping by ForkJoinPool. */ - static final class PerformCleanupTask extends ForkJoinTask implements Runnable { + static final class PerformCleanupTask extends ForkJoinTask<@Nullable Void> implements Runnable { private static final long serialVersionUID = 1L; final WeakReference> reference; @@ -3901,10 +3901,10 @@ public void run() { */ // public final void quietlyComplete() {} - @Override public Void getRawResult() { return null; } - @Override public void setRawResult(Void v) {} - @Override public void complete(Void value) {} + @Override public void setRawResult(@Nullable Void v) {} + @Override public void complete(@Nullable Void value) {} @Override public void completeExceptionally(Throwable ex) {} + @Override public @Nullable Void getRawResult() { return null; } @Override public boolean cancel(boolean mayInterruptIfRunning) { return false; } } @@ -3967,8 +3967,12 @@ public BoundedLocalCache cache() { @Override public Policy policy() { - var p = policy; - return (p == null) ? (policy = new BoundedPolicy<>(cache, identity(), cache.isWeighted)) : p; + if (policy == null) { + @SuppressWarnings("NullAway") + Function<@Nullable V, @Nullable V> identity = identity(); + policy = new BoundedPolicy<>(cache, identity, cache.isWeighted); + } + return policy; } private void readObject(ObjectInputStream stream) throws InvalidObjectException { @@ -4527,8 +4531,8 @@ public Policy policy() { @SuppressWarnings("unchecked") var castCache = (BoundedLocalCache) cache; Function, @Nullable V> transformer = Async::getIfReady; - @SuppressWarnings("unchecked") - var castTransformer = (Function) transformer; + @SuppressWarnings({"NullAway", "unchecked", "Varifier"}) + Function<@Nullable V, @Nullable V> castTransformer = (Function) transformer; policy = new BoundedPolicy<>(castCache, castTransformer, isWeighted); } return policy; @@ -4579,8 +4583,8 @@ public Policy policy() { @SuppressWarnings("unchecked") var castCache = (BoundedLocalCache) cache; Function, @Nullable V> transformer = Async::getIfReady; - @SuppressWarnings("unchecked") - var castTransformer = (Function) transformer; + @SuppressWarnings({"NullAway", "unchecked", "Varifier"}) + Function<@Nullable V, @Nullable V> castTransformer = (Function) transformer; policy = new BoundedPolicy<>(castCache, castTransformer, isWeighted); } return policy; diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Cache.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Cache.java index 251e4c8a46..cddcd68179 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Cache.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Cache.java @@ -20,9 +20,8 @@ import java.util.concurrent.ConcurrentMap; import java.util.function.Function; -import org.checkerframework.checker.index.qual.NonNegative; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.checkerframework.checker.nullness.qual.PolyNull; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.stats.CacheStats; @@ -38,6 +37,7 @@ * @param the type of keys maintained by this cache * @param the type of mapped values */ +@NullMarked public interface Cache { /** @@ -77,8 +77,7 @@ public interface Cache { * @throws RuntimeException or Error if the mappingFunction does so, in which case the mapping is * left unestablished */ - @PolyNull - V get(K key, Function mappingFunction); + V get(K key, Function mappingFunction); /** * Returns a map of the values associated with the {@code keys} in this cache. The returned map @@ -180,7 +179,6 @@ Map getAll(Iterable keys, * * @return the estimated number of mappings */ - @NonNegative long estimatedSize(); /** 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 84e842fa6a..217c81a868 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 @@ -24,7 +24,8 @@ import java.util.concurrent.Executor; import java.util.function.Function; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; /** * Computes or retrieves values, based on a key, for use in populating a {@link LoadingCache} or @@ -43,6 +44,7 @@ * @param the type of values * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked @FunctionalInterface @SuppressWarnings({"FunctionalInterfaceMethodChanged", "PMD.SignatureDeclareThrowsException"}) public interface CacheLoader extends AsyncCacheLoader { diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java index 12296fc8db..f4e5f23428 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Caffeine.java @@ -36,8 +36,8 @@ import java.util.concurrent.TimeUnit; import java.util.function.Supplier; -import org.checkerframework.checker.index.qual.NonNegative; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.Async.AsyncEvictionListener; import com.github.benmanes.caffeine.cache.Async.AsyncExpiry; @@ -137,6 +137,7 @@ * normally {@code Object} unless it is constrained by using a method like {@code * #removalListener} */ +@NullMarked public final class Caffeine { static final Supplier ENABLED_STATS_COUNTER_SUPPLIER = ConcurrentStatsCounter::new; static final Logger logger = System.getLogger(Caffeine.class.getName()); @@ -309,7 +310,7 @@ public static Caffeine from(String spec) { * @throws IllegalStateException if an initial capacity was already set */ @CanIgnoreReturnValue - public Caffeine initialCapacity(@NonNegative int initialCapacity) { + public Caffeine initialCapacity(int initialCapacity) { requireState(this.initialCapacity == UNSET_INT, "initial capacity was already set to %s", this.initialCapacity); requireArgument(initialCapacity >= 0); @@ -407,7 +408,7 @@ Scheduler getScheduler() { * @throws IllegalStateException if a maximum size or weight was already set */ @CanIgnoreReturnValue - public Caffeine maximumSize(@NonNegative long maximumSize) { + public Caffeine maximumSize(long maximumSize) { requireState(this.maximumSize == UNSET_INT, "maximum size was already set to %s", this.maximumSize); requireState(this.maximumWeight == UNSET_INT, @@ -444,7 +445,7 @@ public Caffeine maximumSize(@NonNegative long maximumSize) { * @throws IllegalStateException if a maximum weight or size was already set */ @CanIgnoreReturnValue - public Caffeine maximumWeight(@NonNegative long maximumWeight) { + public Caffeine maximumWeight(long maximumWeight) { requireState(this.maximumWeight == UNSET_INT, "maximum weight was already set to %s", this.maximumWeight); requireState(this.maximumSize == UNSET_INT, @@ -652,7 +653,7 @@ public Caffeine expireAfterWrite(Duration duration) { * @throws IllegalStateException if the time to live or variable expiration was already set */ @CanIgnoreReturnValue - public Caffeine expireAfterWrite(@NonNegative long duration, TimeUnit unit) { + public Caffeine expireAfterWrite(long duration, TimeUnit unit) { requireState(expireAfterWriteNanos == UNSET_INT, "expireAfterWrite was already set to %s ns", expireAfterWriteNanos); requireState(expiry == null, "expireAfterWrite may not be used with variable expiration"); @@ -716,7 +717,7 @@ public Caffeine expireAfterAccess(Duration duration) { * @throws IllegalStateException if the time to idle or variable expiration was already set */ @CanIgnoreReturnValue - public Caffeine expireAfterAccess(@NonNegative long duration, TimeUnit unit) { + public Caffeine expireAfterAccess(long duration, TimeUnit unit) { requireState(expireAfterAccessNanos == UNSET_INT, "expireAfterAccess was already set to %s ns", expireAfterAccessNanos); requireState(expiry == null, "expireAfterAccess may not be used with variable expiration"); @@ -836,7 +837,7 @@ public Caffeine refreshAfterWrite(Duration duration) { * @throws IllegalStateException if the refresh interval was already set */ @CanIgnoreReturnValue - public Caffeine refreshAfterWrite(@NonNegative long duration, TimeUnit unit) { + public Caffeine refreshAfterWrite(long duration, TimeUnit unit) { requireNonNull(unit); requireState(refreshAfterWriteNanos == UNSET_INT, "refreshAfterWriteNanos was already set to %s ns", refreshAfterWriteNanos); diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/CaffeineSpec.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/CaffeineSpec.java index a920c16953..fb67357a1f 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/CaffeineSpec.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/CaffeineSpec.java @@ -25,7 +25,8 @@ import java.util.Objects; import java.util.concurrent.TimeUnit; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.Caffeine.Strength; @@ -70,6 +71,7 @@ * * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked public final class CaffeineSpec { static final String SPLIT_OPTIONS = ","; static final String SPLIT_KEY_VALUE = "="; diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Expiry.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Expiry.java index bdeaccd87a..15a04ede98 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Expiry.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Expiry.java @@ -22,7 +22,7 @@ import java.time.Duration; import java.util.function.BiFunction; -import org.checkerframework.checker.index.qual.NonNegative; +import org.jspecify.annotations.NullMarked; import com.google.errorprone.annotations.CanIgnoreReturnValue; @@ -42,6 +42,7 @@ * @param the type of values * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked public interface Expiry { /** @@ -76,7 +77,7 @@ public interface Expiry { * @param currentDuration the entry's current duration, in nanoseconds * @return the length of time before the entry expires, in nanoseconds */ - long expireAfterUpdate(K key, V value, long currentTime, @NonNegative long currentDuration); + long expireAfterUpdate(K key, V value, long currentTime, long currentDuration); /** * Specifies that the entry should be automatically removed from the cache once the duration has @@ -94,7 +95,7 @@ public interface Expiry { * @param currentDuration the entry's current duration, in nanoseconds * @return the length of time before the entry expires, in nanoseconds */ - long expireAfterRead(K key, V value, long currentTime, @NonNegative long currentDuration); + long expireAfterRead(K key, V value, long currentTime, long currentDuration); /** * Returns an {@code Expiry} that specifies that the entry should be automatically removed from diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/FrequencySketch.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/FrequencySketch.java index d3a40e893a..fc319e512c 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/FrequencySketch.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/FrequencySketch.java @@ -17,8 +17,6 @@ import static com.github.benmanes.caffeine.cache.Caffeine.requireArgument; -import org.checkerframework.checker.index.qual.NonNegative; - import com.google.errorprone.annotations.Var; /** @@ -88,7 +86,7 @@ public FrequencySketch() {} * @param maximumSize the maximum size of the cache */ @SuppressWarnings("Varifier") - public void ensureCapacity(@NonNegative long maximumSize) { + public void ensureCapacity(long maximumSize) { requireArgument(maximumSize >= 0); int maximum = (int) Math.min(maximumSize, Integer.MAX_VALUE >>> 1); if ((table != null) && (table.length >= maximum)) { @@ -119,7 +117,7 @@ public boolean isNotInitialized() { * @return the estimated number of occurrences of the element; possibly zero but never negative */ @SuppressWarnings("Varifier") - public @NonNegative int frequency(E e) { + public int frequency(E e) { if (isNotInitialized()) { return 0; } diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Interner.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Interner.java index f995c60ccb..c6210dc276 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Interner.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Interner.java @@ -21,6 +21,8 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; +import org.jspecify.annotations.NullMarked; + import com.github.benmanes.caffeine.cache.References.LookupKeyEqualsReference; import com.github.benmanes.caffeine.cache.References.WeakKeyEqualsReference; @@ -34,6 +36,7 @@ * @param the type of elements * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked @FunctionalInterface public interface Interner { diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LinkedDeque.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LinkedDeque.java index 44a311d1fe..9c3fed30df 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LinkedDeque.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LinkedDeque.java @@ -21,7 +21,7 @@ import java.util.Iterator; import java.util.NoSuchElementException; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; /** * A linked list extension of the {@link Deque} interface where the link pointers are tightly diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LoadingCache.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LoadingCache.java index 564c13c2c2..c06aeb2116 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LoadingCache.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LoadingCache.java @@ -19,6 +19,8 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletionException; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CanIgnoreReturnValue; /** @@ -32,6 +34,7 @@ * @param the type of keys maintained by this cache * @param the type of mapped values */ +@NullMarked public interface LoadingCache extends Cache { /** diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncCache.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncCache.java index 5170ac155f..fa2e56b7df 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncCache.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncCache.java @@ -44,7 +44,7 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.LocalAsyncCache.AsyncBulkCompleter.NullMapCompletionException; import com.github.benmanes.caffeine.cache.stats.CacheStats; @@ -500,7 +500,7 @@ public boolean replace(K key, CompletableFuture oldValue, CompletableFuture> entrySet() { /** See {@link BoundedLocalCache#equals(Object)} for semantics. */ @Override - public boolean equals(Object o) { + public boolean equals(@Nullable Object o) { if (o == this) { return true; } else if (!(o instanceof Map)) { diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncLoadingCache.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncLoadingCache.java index fd406d3c4b..0452622871 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncLoadingCache.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncLoadingCache.java @@ -33,7 +33,7 @@ import java.util.function.BiFunction; import java.util.function.Function; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.google.errorprone.annotations.Var; diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalCache.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalCache.java index 0024e52edd..c3dc388a31 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalCache.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalCache.java @@ -22,7 +22,7 @@ import java.util.function.BiFunction; import java.util.function.Function; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.stats.StatsCounter; diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalCacheFactory.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalCacheFactory.java index b1295ccc52..6229a1e161 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalCacheFactory.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalCacheFactory.java @@ -21,7 +21,7 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.google.errorprone.annotations.Var; diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalLoadingCache.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalLoadingCache.java index 0765da35b7..1fb618c693 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalLoadingCache.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalLoadingCache.java @@ -32,7 +32,7 @@ import java.util.concurrent.TimeoutException; import java.util.function.Function; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.google.errorprone.annotations.Var; diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalManualCache.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalManualCache.java index f57a35d238..d2e008b2f5 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalManualCache.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalManualCache.java @@ -26,7 +26,7 @@ import java.util.concurrent.ConcurrentMap; import java.util.function.Function; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.stats.CacheStats; import com.google.errorprone.annotations.Var; diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Node.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Node.java index 3304ce4b44..d5135afc81 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Node.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Node.java @@ -19,8 +19,7 @@ import java.lang.ref.ReferenceQueue; -import org.checkerframework.checker.index.qual.NonNegative; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.AccessOrderDeque.AccessOrder; import com.github.benmanes.caffeine.cache.WriteOrderDeque.WriteOrder; @@ -64,23 +63,23 @@ abstract class Node implements AccessOrder>, WriteOrder the type of values * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked public interface Policy { /** @@ -189,7 +189,6 @@ interface Eviction { * * @return the maximum size bounding, which may be either weighted or unweighted */ - @NonNegative long getMaximum(); /** @@ -205,7 +204,7 @@ interface Eviction { * cache was constructed * @throws IllegalArgumentException if the maximum size specified is negative */ - void setMaximum(@NonNegative long maximum); + void setMaximum(long maximum); /** * Returns an unmodifiable snapshot {@link Map} view of the cache with ordered traversal. The @@ -220,8 +219,9 @@ interface Eviction { * @param limit the maximum size of the returned map (use {@link Integer#MAX_VALUE} to disregard * the limit) * @return a snapshot view of the cache from the coldest entry to the hottest + * @throws IllegalArgumentException if the limit specified is negative */ - Map coldest(@NonNegative int limit); + Map coldest(int limit); /** * Returns an unmodifiable snapshot {@link Map} view of the cache with ordered traversal. The @@ -237,8 +237,9 @@ interface Eviction { * @param weightLimit the maximum weight of the returned map (use {@link Long#MAX_VALUE} to * disregard the limit) * @return a snapshot view of the cache from the coldest entry to the hottest + * @throws IllegalArgumentException if the limit specified is negative */ - default Map coldestWeighted(@NonNegative long weightLimit) { + default Map coldestWeighted(long weightLimit) { // This method was added & implemented in version 3.0.4 throw new UnsupportedOperationException(); } @@ -285,8 +286,9 @@ default T coldest(Function>, T> mappingFunction) { * @param limit the maximum size of the returned map (use {@link Integer#MAX_VALUE} to disregard * the limit) * @return a snapshot view of the cache from the hottest entry to the coldest + * @throws IllegalArgumentException if the limit specified is negative */ - Map hottest(@NonNegative int limit); + Map hottest(int limit); /** * Returns an unmodifiable snapshot {@link Map} view of the cache with ordered traversal. The @@ -302,8 +304,9 @@ default T coldest(Function>, T> mappingFunction) { * @param weightLimit the maximum weight of the returned map (use {@link Long#MAX_VALUE} to * disregard the limit) * @return a snapshot view of the cache from the hottest entry to the coldest + * @throws IllegalArgumentException if the limit specified is negative */ - default Map hottestWeighted(@NonNegative long weightLimit) { + default Map hottestWeighted(long weightLimit) { // This method was added & implemented in version 3.0.4 throw new UnsupportedOperationException(); } @@ -390,7 +393,6 @@ default Optional ageOf(K key) { * @return the length of time after which an entry should be automatically removed * @throws NullPointerException if the unit is null */ - @NonNegative long getExpiresAfter(TimeUnit unit); /** @@ -414,7 +416,7 @@ default Duration getExpiresAfter() { * @throws IllegalArgumentException if {@code duration} is negative * @throws NullPointerException if the unit is null */ - void setExpiresAfter(@NonNegative long duration, TimeUnit unit); + void setExpiresAfter(long duration, TimeUnit unit); /** * Specifies that each entry should be automatically removed from the cache once a fixed @@ -441,8 +443,9 @@ default void setExpiresAfter(Duration duration) { * @param limit the maximum size of the returned map (use {@link Integer#MAX_VALUE} to disregard * the limit) * @return a snapshot view of the cache from the oldest entry to the youngest + * @throws IllegalArgumentException if the limit specified is negative */ - Map oldest(@NonNegative int limit); + Map oldest(int limit); /** * Returns the computed result from the ordered traversal of the cache entries. The oorder of @@ -484,8 +487,9 @@ default T oldest(Function>, T> mappingFunction) { * @param limit the maximum size of the returned map (use {@link Integer#MAX_VALUE} to disregard * the limit) * @return a snapshot view of the cache from the youngest entry to the oldest + * @throws IllegalArgumentException if the limit specified is negative */ - Map youngest(@NonNegative int limit); + Map youngest(int limit); /** * Returns the computed result from the ordered traversal of the cache entries. The order of @@ -559,7 +563,7 @@ default Optional getExpiresAfter(K key) { * @throws IllegalArgumentException if {@code duration} is negative * @throws NullPointerException if the specified key or unit is null */ - void setExpiresAfter(K key, @NonNegative long duration, TimeUnit unit); + void setExpiresAfter(K key, long duration, TimeUnit unit); /** * Specifies that the entry should be automatically removed from the cache once the duration has @@ -589,7 +593,7 @@ default void setExpiresAfter(K key, Duration duration) { * @throws IllegalArgumentException if {@code duration} is negative * @throws NullPointerException if the specified key, value, or unit is null */ - @Nullable V putIfAbsent(K key, V value, @NonNegative long duration, TimeUnit unit); + @Nullable V putIfAbsent(K key, V value, long duration, TimeUnit unit); /** * Associates the {@code value} with the {@code key} in this cache if the specified key is not @@ -624,7 +628,7 @@ default void setExpiresAfter(K key, Duration duration) { * @throws IllegalArgumentException if {@code duration} is negative * @throws NullPointerException if the specified key, value, or unit is null */ - @Nullable V put(K key, V value, @NonNegative long duration, TimeUnit unit); + @Nullable V put(K key, V value, long duration, TimeUnit unit); /** * Associates the {@code value} with the {@code key} in this cache. If the cache previously @@ -667,8 +671,8 @@ default void setExpiresAfter(K key, Duration duration) { * @throws RuntimeException or Error if the remappingFunction does so, in which case the mapping * is unchanged */ - default @PolyNull V compute(K key, - BiFunction remappingFunction, + default @Nullable V compute(K key, + BiFunction remappingFunction, Duration duration) { // This method was added & implemented in version 3.0.6 throw new UnsupportedOperationException(); @@ -687,8 +691,9 @@ default void setExpiresAfter(K key, Duration duration) { * @param limit the maximum size of the returned map (use {@link Integer#MAX_VALUE} to disregard * the limit) * @return a snapshot view of the cache from the oldest entry to the youngest + * @throws IllegalArgumentException if the limit specified is negative */ - Map oldest(@NonNegative int limit); + Map oldest(int limit); /** * Returns the computed result from the ordered traversal of the cache entries. The oorder of @@ -730,8 +735,9 @@ default T oldest(Function>, T> mappingFunction) { * @param limit the maximum size of the returned map (use {@link Integer#MAX_VALUE} to disregard * the limit) * @return a snapshot view of the cache from the youngest entry to the oldest + * @throws IllegalArgumentException if the limit specified is negative */ - Map youngest(@NonNegative int limit); + Map youngest(int limit); /** * Returns the computed result from the ordered traversal of the cache entries. The order of @@ -813,7 +819,6 @@ default Optional ageOf(K key) { * @return the length of time after which an entry is eligible to be reloaded * @throws NullPointerException if the unit is null */ - @NonNegative long getRefreshesAfter(TimeUnit unit); /** @@ -837,7 +842,7 @@ default Duration getRefreshesAfter() { * @throws IllegalArgumentException if {@code duration} is negative * @throws NullPointerException if the unit is null */ - void setRefreshesAfter(@NonNegative long duration, TimeUnit unit); + void setRefreshesAfter(long duration, TimeUnit unit); /** * Specifies that each entry should be eligible for reloading once a fixed duration has elapsed. @@ -861,6 +866,7 @@ default void setRefreshesAfter(Duration duration) { * @param the type of keys * @param the type of values */ + @NullMarked interface CacheEntry extends Map.Entry { /** diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/References.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/References.java index 02cb98f3b3..b9d868ed1a 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/References.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/References.java @@ -23,7 +23,7 @@ import java.lang.ref.WeakReference; import java.util.Objects; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; /** * Static utility methods and classes pertaining to weak and soft references. @@ -83,7 +83,7 @@ default boolean referenceEquals(@Nullable Object object) { * @return {@code true} if this object is equivalent by {@link Object#equals} as the argument; * {@code false} otherwise */ - default boolean objectEquals(Object object) { + default boolean objectEquals(@Nullable Object object) { if (object == this) { return true; } else if (object instanceof InternalReference) { @@ -119,7 +119,7 @@ public Object getKeyReference() { } @Override - public boolean equals(Object object) { + public boolean equals(@Nullable Object object) { return referenceEquals(object); } @@ -160,7 +160,7 @@ public Object getKeyReference() { } @Override - public boolean equals(Object object) { + public boolean equals(@Nullable Object object) { return objectEquals(object); } @@ -195,7 +195,7 @@ public Object getKeyReference() { } @Override - public boolean equals(Object object) { + public boolean equals(@Nullable Object object) { return referenceEquals(object); } @@ -231,7 +231,7 @@ public Object getKeyReference() { } @Override - public boolean equals(Object object) { + public boolean equals(@Nullable Object object) { return objectEquals(object); } @@ -272,7 +272,7 @@ public void setKeyReference(Object keyReference) { } @Override - public boolean equals(Object object) { + public boolean equals(@Nullable Object object) { return referenceEquals(object); } @@ -313,7 +313,7 @@ public void setKeyReference(Object keyReference) { } @Override - public boolean equals(Object object) { + public boolean equals(@Nullable Object object) { return referenceEquals(object); } diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/RemovalCause.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/RemovalCause.java index 9cc6862fb5..92f3a9947f 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/RemovalCause.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/RemovalCause.java @@ -15,11 +15,14 @@ */ package com.github.benmanes.caffeine.cache; +import org.jspecify.annotations.NullMarked; + /** * The reason why a cached entry was removed. * * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked public enum RemovalCause { /** diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/RemovalListener.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/RemovalListener.java index 963e6b2a5e..268a6b2e57 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/RemovalListener.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/RemovalListener.java @@ -15,7 +15,8 @@ */ package com.github.benmanes.caffeine.cache; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; /** * An object that can receive a notification when an entry is removed from a cache. The removal @@ -32,6 +33,7 @@ * @param the most general type of values this listener can listen for; for example * {@code Object} if any value is acceptable */ +@NullMarked @FunctionalInterface public interface RemovalListener { diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Scheduler.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Scheduler.java index e619c9040e..85f43b0666 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Scheduler.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Scheduler.java @@ -26,11 +26,15 @@ import java.util.concurrent.ScheduledExecutorService; import java.util.concurrent.TimeUnit; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; + /** * A scheduler that submits a task to an executor after a given delay. * * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked @FunctionalInterface public interface Scheduler { @@ -43,7 +47,8 @@ public interface Scheduler { * @param unit a {@code TimeUnit} determining how to interpret the {@code delay} parameter * @return a scheduled future representing the pending submission of the task */ - Future schedule(Executor executor, Runnable command, long delay, TimeUnit unit); + Future schedule( + Executor executor, Runnable command, long delay, TimeUnit unit); /** * Returns a scheduler that always returns a successfully completed future. @@ -112,13 +117,14 @@ final class ExecutorServiceScheduler implements Scheduler, Serializable { } @Override - public Future schedule(Executor executor, Runnable command, long delay, TimeUnit unit) { + public Future schedule( + Executor executor, Runnable command, long delay, TimeUnit unit) { requireNonNull(executor); requireNonNull(command); requireNonNull(unit); if (scheduledExecutorService.isShutdown()) { - return DisabledFuture.INSTANCE; + return DisabledFuture.instance(); } return scheduledExecutorService.schedule(() -> { try { @@ -143,13 +149,14 @@ final class GuardedScheduler implements Scheduler, Serializable { } @Override - public Future schedule(Executor executor, Runnable command, long delay, TimeUnit unit) { + public Future schedule( + Executor executor, Runnable command, long delay, TimeUnit unit) { try { - Future future = delegate.schedule(executor, command, delay, unit); - return (future == null) ? DisabledFuture.INSTANCE : future; + var future = delegate.schedule(executor, command, delay, unit); + return (future == null) ? DisabledFuture.instance() : future; } catch (Throwable t) { logger.log(Level.WARNING, "Exception thrown by scheduler; discarded task", t); - return DisabledFuture.INSTANCE; + return DisabledFuture.instance(); } } } @@ -158,18 +165,24 @@ enum DisabledScheduler implements Scheduler { INSTANCE; @Override - public Future schedule(Executor executor, Runnable command, long delay, TimeUnit unit) { + public Future schedule( + Executor executor, Runnable command, long delay, TimeUnit unit) { requireNonNull(executor); requireNonNull(command); requireNonNull(unit); - return DisabledFuture.INSTANCE; + return DisabledFuture.instance(); } } @SuppressWarnings("CheckedExceptionNotThrown") -enum DisabledFuture implements Future { +enum DisabledFuture implements Future<@Nullable Void> { INSTANCE; + @SuppressWarnings("NullAway") + static Future instance() { + return INSTANCE; + } + @Override public boolean isDone() { return true; } @@ -179,11 +192,11 @@ enum DisabledFuture implements Future { @Override public boolean cancel(boolean mayInterruptIfRunning) { return false; } - @Override public Void get(long timeout, TimeUnit unit) { + @Override public @Nullable Void get(long timeout, TimeUnit unit) { requireNonNull(unit); return null; } - @Override public Void get() { + @Override public @Nullable Void get() { return null; } } diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/SerializationProxy.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/SerializationProxy.java index 2b513a2b54..6ff4ba385e 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/SerializationProxy.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/SerializationProxy.java @@ -20,7 +20,7 @@ import java.io.Serializable; import java.time.Duration; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; /** * Serializes the configuration of the cache, reconstituting it as a {@link Cache}, diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/SnapshotEntry.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/SnapshotEntry.java index 4f4e7db6ba..da44b7ebda 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/SnapshotEntry.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/SnapshotEntry.java @@ -19,6 +19,8 @@ import java.util.Map; +import org.jspecify.annotations.Nullable; + import com.github.benmanes.caffeine.cache.Policy.CacheEntry; import com.google.errorprone.annotations.Immutable; @@ -59,7 +61,7 @@ class SnapshotEntry implements CacheEntry { @Override public long snapshotAt() { return snapshot; } - @Override public boolean equals(Object o) { + @Override public boolean equals(@Nullable Object o) { if (o == this) { return true; } else if (!(o instanceof Map.Entry)) { diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/StripedBuffer.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/StripedBuffer.java index c95ede8d87..b310b3fe10 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/StripedBuffer.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/StripedBuffer.java @@ -27,7 +27,7 @@ import java.util.Arrays; import java.util.function.Consumer; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.google.errorprone.annotations.Var; diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Ticker.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Ticker.java index 4e6d687a69..0474361b4b 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Ticker.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Ticker.java @@ -15,12 +15,15 @@ */ package com.github.benmanes.caffeine.cache; +import org.jspecify.annotations.NullMarked; + /** * A time source that returns a time value representing the number of nanoseconds elapsed since some * fixed but arbitrary point in time. * * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked @FunctionalInterface public interface Ticker { diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/TimerWheel.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/TimerWheel.java index df9911920b..7f875682d3 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/TimerWheel.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/TimerWheel.java @@ -23,7 +23,7 @@ import java.util.NoSuchElementException; import java.util.concurrent.TimeUnit; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.google.errorprone.annotations.Var; diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/UnboundedLocalCache.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/UnboundedLocalCache.java index 49a4883891..be69e5c4b7 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/UnboundedLocalCache.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/UnboundedLocalCache.java @@ -50,7 +50,7 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.stats.StatsCounter; import com.google.errorprone.annotations.CanIgnoreReturnValue; @@ -545,7 +545,7 @@ public boolean replace(K key, V oldValue, V newValue, boolean shouldDiscardRefre @Override @SuppressWarnings("EqualsWhichDoesntCheckParameterClass") - public boolean equals(Object o) { + public boolean equals(@Nullable Object o) { return (o == this) || data.equals(o); } @@ -1041,9 +1041,12 @@ public UnboundedLocalCache cache() { @Override public Policy policy() { - return (policy == null) - ? (policy = new UnboundedPolicy<>(cache, identity())) - : policy; + if (policy == null) { + @SuppressWarnings("NullAway") + Function<@Nullable V, @Nullable V> identity = identity(); + policy = new UnboundedPolicy<>(cache, identity); + } + return policy; } private void readObject(ObjectInputStream stream) throws InvalidObjectException { @@ -1189,8 +1192,8 @@ public Policy policy() { @SuppressWarnings("unchecked") var castCache = (UnboundedLocalCache) cache; Function, @Nullable V> transformer = Async::getIfReady; - @SuppressWarnings("unchecked") - var castTransformer = (Function) transformer; + @SuppressWarnings({"NullAway", "unchecked", "Varifier"}) + Function<@Nullable V, @Nullable V> castTransformer = (Function) transformer; return (policy == null) ? (policy = new UnboundedPolicy<>(castCache, castTransformer)) : policy; @@ -1242,8 +1245,8 @@ public Policy policy() { @SuppressWarnings("unchecked") var castCache = (UnboundedLocalCache) cache; Function, @Nullable V> transformer = Async::getIfReady; - @SuppressWarnings("unchecked") - var castTransformer = (Function) transformer; + @SuppressWarnings({"NullAway", "unchecked", "Varifier"}) + Function<@Nullable V, @Nullable V> castTransformer = (Function) transformer; return (policy == null) ? (policy = new UnboundedPolicy<>(castCache, castTransformer)) : policy; diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Weigher.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Weigher.java index 8b7cac4561..d65a87fbfb 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Weigher.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Weigher.java @@ -20,7 +20,7 @@ import java.io.Serializable; -import org.checkerframework.checker.index.qual.NonNegative; +import org.jspecify.annotations.NullMarked; /** * Calculates the weights of cache entries. The total weight threshold is used to determine when an @@ -30,6 +30,7 @@ * @param the type of values * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked @FunctionalInterface public interface Weigher { @@ -41,7 +42,6 @@ public interface Weigher { * @param value the value to weigh * @return the weight of the entry; must be non-negative */ - @NonNegative int weigh(K key, V value); /** diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/WriteOrderDeque.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/WriteOrderDeque.java index ead6fe7fb5..b83c3c2a2d 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/WriteOrderDeque.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/WriteOrderDeque.java @@ -17,7 +17,7 @@ import java.util.Deque; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.WriteOrderDeque.WriteOrder; diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/package-info.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/package-info.java index 0cb37b81bb..e86728caae 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/package-info.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/package-info.java @@ -38,14 +38,10 @@ * * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked @CheckReturnValue -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.FIELD) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.PARAMETER) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.RETURN) package com.github.benmanes.caffeine.cache; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.framework.qual.DefaultQualifier; -import org.checkerframework.framework.qual.TypeUseLocation; +import org.jspecify.annotations.NullMarked; import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/CacheStats.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/CacheStats.java index d22feda6d8..f75a7607d2 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/CacheStats.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/CacheStats.java @@ -17,8 +17,8 @@ import java.util.Objects; -import org.checkerframework.checker.index.qual.NonNegative; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.Cache; import com.github.benmanes.caffeine.cache.LoadingCache; @@ -61,6 +61,7 @@ * @author ben.manes@gmail.com (Ben Manes) */ @Immutable +@NullMarked public final class CacheStats { private static final CacheStats EMPTY_STATS = CacheStats.of(0L, 0L, 0L, 0L, 0L, 0L, 0L); @@ -72,10 +73,8 @@ public final class CacheStats { private final long evictionCount; private final long evictionWeight; - private CacheStats(@NonNegative long hitCount, @NonNegative long missCount, - @NonNegative long loadSuccessCount, @NonNegative long loadFailureCount, - @NonNegative long totalLoadTime, @NonNegative long evictionCount, - @NonNegative long evictionWeight) { + private CacheStats(long hitCount, long missCount, long loadSuccessCount, long loadFailureCount, + long totalLoadTime, long evictionCount, long evictionWeight) { if ((hitCount < 0) || (missCount < 0) || (loadSuccessCount < 0) || (loadFailureCount < 0) || (totalLoadTime < 0) || (evictionCount < 0) || (evictionWeight < 0)) { throw new IllegalArgumentException(); @@ -100,11 +99,10 @@ private CacheStats(@NonNegative long hitCount, @NonNegative long missCount, * @param evictionCount the number of entries evicted from the cache * @param evictionWeight the sum of weights of entries evicted from the cache * @return a {@code CacheStats} representing the specified statistics + * @throws IllegalArgumentException if the metric is negative */ - public static CacheStats of(@NonNegative long hitCount, @NonNegative long missCount, - @NonNegative long loadSuccessCount, @NonNegative long loadFailureCount, - @NonNegative long totalLoadTime, @NonNegative long evictionCount, - @NonNegative long evictionWeight) { + public static CacheStats of(long hitCount, long missCount, long loadSuccessCount, + long loadFailureCount, long totalLoadTime, long evictionCount, long evictionWeight) { // Many parameters of the same type in a row is a bad thing, but this class is not constructed // by end users and is too fine-grained for a builder. return new CacheStats(hitCount, missCount, loadSuccessCount, @@ -130,7 +128,7 @@ public static CacheStats empty() { * * @return the {@code hitCount + missCount} */ - public @NonNegative long requestCount() { + public long requestCount() { return saturatedAdd(hitCount, missCount); } @@ -139,7 +137,7 @@ public static CacheStats empty() { * * @return the number of times {@link Cache} lookup methods have returned a cached value */ - public @NonNegative long hitCount() { + public long hitCount() { return hitCount; } @@ -150,7 +148,7 @@ public static CacheStats empty() { * * @return the ratio of cache requests which were hits */ - public @NonNegative double hitRate() { + public double hitRate() { long requestCount = requestCount(); return (requestCount == 0) ? 1.0 : (double) hitCount / requestCount; } @@ -164,7 +162,7 @@ public static CacheStats empty() { * @return the number of times {@link Cache} lookup methods have returned an uncached (newly * loaded) value, or null */ - public @NonNegative long missCount() { + public long missCount() { return missCount; } @@ -179,7 +177,7 @@ public static CacheStats empty() { * * @return the ratio of cache requests which were misses */ - public @NonNegative double missRate() { + public double missRate() { long requestCount = requestCount(); return (requestCount == 0) ? 0.0 : (double) missCount / requestCount; } @@ -195,7 +193,7 @@ public static CacheStats empty() { * * @return the {@code loadSuccessCount + loadFailureCount} */ - public @NonNegative long loadCount() { + public long loadCount() { return saturatedAdd(loadSuccessCount, loadFailureCount); } @@ -208,7 +206,7 @@ public static CacheStats empty() { * * @return the number of times {@link Cache} lookup methods have successfully loaded a new value */ - public @NonNegative long loadSuccessCount() { + public long loadSuccessCount() { return loadSuccessCount; } @@ -221,7 +219,7 @@ public static CacheStats empty() { * * @return the number of times {@link Cache} lookup methods failed to load a new value */ - public @NonNegative long loadFailureCount() { + public long loadFailureCount() { return loadFailureCount; } @@ -236,7 +234,7 @@ public static CacheStats empty() { * * @return the ratio of cache loading attempts which threw exceptions */ - public @NonNegative double loadFailureRate() { + public double loadFailureRate() { long totalLoadCount = saturatedAdd(loadSuccessCount, loadFailureCount); return (totalLoadCount == 0) ? 0.0 : (double) loadFailureCount / totalLoadCount; } @@ -248,7 +246,7 @@ public static CacheStats empty() { * * @return the total number of nanoseconds the cache has spent loading new values */ - public @NonNegative long totalLoadTime() { + public long totalLoadTime() { return totalLoadTime; } @@ -262,7 +260,7 @@ public static CacheStats empty() { * * @return the average number of nanoseconds spent loading new values */ - public @NonNegative double averageLoadPenalty() { + public double averageLoadPenalty() { long totalLoadCount = saturatedAdd(loadSuccessCount, loadFailureCount); return (totalLoadCount == 0) ? 0.0 : (double) totalLoadTime / totalLoadCount; } @@ -273,7 +271,7 @@ public static CacheStats empty() { * * @return the number of times an entry has been evicted */ - public @NonNegative long evictionCount() { + public long evictionCount() { return evictionCount; } @@ -283,7 +281,7 @@ public static CacheStats empty() { * * @return the sum of weights of evicted entities */ - public @NonNegative long evictionWeight() { + public long evictionWeight() { return evictionWeight; } diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/ConcurrentStatsCounter.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/ConcurrentStatsCounter.java index 545610d3b8..af3063ce69 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/ConcurrentStatsCounter.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/ConcurrentStatsCounter.java @@ -19,6 +19,8 @@ import java.util.concurrent.atomic.LongAdder; +import org.jspecify.annotations.NullMarked; + import com.github.benmanes.caffeine.cache.Cache; import com.github.benmanes.caffeine.cache.RemovalCause; @@ -27,6 +29,7 @@ * * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked public final class ConcurrentStatsCounter implements StatsCounter { private final LongAdder hitCount; private final LongAdder missCount; diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/DisabledStatsCounter.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/DisabledStatsCounter.java index 905cad3782..31c927c5b0 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/DisabledStatsCounter.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/DisabledStatsCounter.java @@ -17,8 +17,6 @@ import static java.util.Objects.requireNonNull; -import org.checkerframework.checker.index.qual.NonNegative; - import com.github.benmanes.caffeine.cache.RemovalCause; /** @@ -42,7 +40,7 @@ public void recordLoadSuccess(long loadTime) {} public void recordLoadFailure(long loadTime) {} @Override - public void recordEviction(@NonNegative int weight, RemovalCause cause) { + public void recordEviction(int weight, RemovalCause cause) { requireNonNull(cause); } diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/StatsCounter.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/StatsCounter.java index d346ee7be8..5b44a38b3c 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/StatsCounter.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/StatsCounter.java @@ -17,7 +17,7 @@ import java.util.Map; -import org.checkerframework.checker.index.qual.NonNegative; +import org.jspecify.annotations.NullMarked; import com.github.benmanes.caffeine.cache.Cache; import com.github.benmanes.caffeine.cache.RemovalCause; @@ -28,6 +28,7 @@ * * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked public interface StatsCounter { /** @@ -35,7 +36,7 @@ public interface StatsCounter { * * @param count the number of hits to record */ - void recordHits(@NonNegative int count); + void recordHits(int count); /** * Records cache misses. This should be called when a cache request returns a value that was not @@ -47,7 +48,7 @@ public interface StatsCounter { * * @param count the number of misses to record */ - void recordMisses(@NonNegative int count); + void recordMisses(int count); /** * Records the successful load of a new entry. This method should be called when a cache request @@ -57,7 +58,7 @@ public interface StatsCounter { * * @param loadTime the number of nanoseconds the cache spent computing or retrieving the new value */ - void recordLoadSuccess(@NonNegative long loadTime); + void recordLoadSuccess(long loadTime); /** * Records the failed load of a new entry. This method should be called when a cache request @@ -68,7 +69,7 @@ public interface StatsCounter { * @param loadTime the number of nanoseconds the cache spent computing or retrieving the new value * prior to discovering the value doesn't exist or an exception being thrown */ - void recordLoadFailure(@NonNegative long loadTime); + void recordLoadFailure(long loadTime); /** * Records the eviction of an entry from the cache. This should only been called when an entry is @@ -78,7 +79,7 @@ public interface StatsCounter { * @param weight the weight of the evicted entry * @param cause the reason for which the entry was removed */ - void recordEviction(@NonNegative int weight, RemovalCause cause); + void recordEviction(int weight, RemovalCause cause); /** * Returns a snapshot of this counter's values. Note that this may be an inconsistent view, as it diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/package-info.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/package-info.java index e3c4d5017b..4daff4f0be 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/package-info.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/stats/package-info.java @@ -19,14 +19,10 @@ * * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked @CheckReturnValue -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.FIELD) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.PARAMETER) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.RETURN) package com.github.benmanes.caffeine.cache.stats; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.framework.qual.DefaultQualifier; -import org.checkerframework.framework.qual.TypeUseLocation; +import org.jspecify.annotations.NullMarked; import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/main/java/module-info.java b/caffeine/src/main/java/module-info.java index 28fbf809f8..b9ba210c0a 100644 --- a/caffeine/src/main/java/module-info.java +++ b/caffeine/src/main/java/module-info.java @@ -4,5 +4,5 @@ exports com.github.benmanes.caffeine.cache.stats; requires static com.google.errorprone.annotations; - requires static org.checkerframework.checker.qual; + requires static org.jspecify; } diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/apache/package-info.java b/caffeine/src/test/java/com/github/benmanes/caffeine/apache/package-info.java index 9270e849a5..b4224b36a3 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/apache/package-info.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/apache/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.apache; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/CacheTest.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/CacheTest.java index 9483f5a9ac..feb55527b9 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/CacheTest.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/CacheTest.java @@ -55,7 +55,7 @@ import java.util.stream.IntStream; import org.apache.commons.lang3.tuple.Triple; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import org.mockito.Mockito; import org.mockito.stubbing.Answer; import org.testng.annotations.Listeners; diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/LinkedDequeTests.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/LinkedDequeTests.java index 758696c627..38c579cf53 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/LinkedDequeTests.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/LinkedDequeTests.java @@ -20,7 +20,7 @@ import java.util.Queue; import java.util.function.Supplier; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.AccessOrderDeque.AccessOrder; import com.github.benmanes.caffeine.cache.WriteOrderDeque.WriteOrder; diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/TimerWheelTest.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/TimerWheelTest.java index e89d4ab76d..4141be2b87 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/TimerWheelTest.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/TimerWheelTest.java @@ -44,7 +44,7 @@ import java.util.stream.IntStream; import java.util.stream.LongStream; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import org.mockito.ArgumentCaptor; import org.mockito.Captor; import org.mockito.Mock; diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/buffer/package-info.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/buffer/package-info.java index 1974f97a7b..9171e2bf78 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/buffer/package-info.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/buffer/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.buffer; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/issues/package-info.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/issues/package-info.java index 05d7842b0d..52502dad6a 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/issues/package-info.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/issues/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.issues; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/package-info.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/package-info.java index 6a536374b0..a00ec4f1f7 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/package-info.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/stats/package-info.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/stats/package-info.java index c5d91d8e79..d552762417 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/stats/package-info.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/stats/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.stats; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/CacheContext.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/CacheContext.java index faf0e0543b..016c317c0b 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/CacheContext.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/CacheContext.java @@ -30,7 +30,7 @@ import java.util.concurrent.ThreadLocalRandom; import java.util.function.Function; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.AsyncCache; import com.github.benmanes.caffeine.cache.AsyncCacheLoader; diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/RemovalNotification.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/RemovalNotification.java index f8e6709853..85df025a19 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/RemovalNotification.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/RemovalNotification.java @@ -19,7 +19,7 @@ import java.util.AbstractMap.SimpleImmutableEntry; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.RemovalCause; import com.google.errorprone.annotations.Immutable; diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/package-info.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/package-info.java index a63f5a0e1c..a0b3db4fd2 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/package-info.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/testing/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.testing; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/eclipse/acceptance/package-info.java b/caffeine/src/test/java/com/github/benmanes/caffeine/eclipse/acceptance/package-info.java index 4462c3fc04..d60faccb8e 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/eclipse/acceptance/package-info.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/eclipse/acceptance/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.eclipse.acceptance; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/eclipse/mutable/package-info.java b/caffeine/src/test/java/com/github/benmanes/caffeine/eclipse/mutable/package-info.java index 185eb6960e..7e35d237c6 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/eclipse/mutable/package-info.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/eclipse/mutable/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.eclipse.mutable; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/eclipse/package-info.java b/caffeine/src/test/java/com/github/benmanes/caffeine/eclipse/package-info.java index 3dff8e7ad7..5147944a3f 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/eclipse/package-info.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/eclipse/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.eclipse; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/fuzz/package-info.java b/caffeine/src/test/java/com/github/benmanes/caffeine/fuzz/package-info.java new file mode 100644 index 0000000000..99f4496c8a --- /dev/null +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/fuzz/package-info.java @@ -0,0 +1,7 @@ +@NullMarked +@CheckReturnValue +package com.github.benmanes.caffeine.fuzz; + +import org.jspecify.annotations.NullMarked; + +import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/google/package-info.java b/caffeine/src/test/java/com/github/benmanes/caffeine/google/package-info.java index 3fac419333..b20cadb6ad 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/google/package-info.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/google/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.google; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/jsr166/JSR166TestCase.java b/caffeine/src/test/java/com/github/benmanes/caffeine/jsr166/JSR166TestCase.java index 9a255cff09..905872dfaa 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/jsr166/JSR166TestCase.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/jsr166/JSR166TestCase.java @@ -99,7 +99,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.regex.Pattern; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import junit.framework.Test; import junit.framework.TestCase; diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/jsr166/package-info.java b/caffeine/src/test/java/com/github/benmanes/caffeine/jsr166/package-info.java index 21a610d0af..2bdc3c41d3 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/jsr166/package-info.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/jsr166/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.jsr166; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/lincheck/package-info.java b/caffeine/src/test/java/com/github/benmanes/caffeine/lincheck/package-info.java index 7b4d6d1976..352232d65d 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/lincheck/package-info.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/lincheck/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.lincheck; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/package-info.java b/caffeine/src/test/java/com/github/benmanes/caffeine/package-info.java index 7e490e3225..3339cf3563 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/package-info.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/testing/package-info.java b/caffeine/src/test/java/com/github/benmanes/caffeine/testing/package-info.java index 93eeda5244..3e1740f3b6 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/testing/package-info.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/testing/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.testing; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index b1180b843c..a8754db053 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -7,7 +7,6 @@ bnd = "7.0.0" bouncycastle-jdk18on = "1.79" cache2k = "2.6.1.Final" caffeine = "3.1.8" -checker-framework = "3.48.2" checkstyle = "10.20.1" coherence = "24.09" commons-collections4 = "4.4" @@ -58,6 +57,7 @@ jmh = "1.37" jmh-plugin = "0.7.2" jmh-report = "0.9.6" joor = "0.9.15" +jspecify = "1.0.0" json-bind = "1.0" jsoup = "1.18.1" junit-testng = "1.0.5" @@ -96,7 +96,7 @@ versions = "0.51.0" xz = "1.10" ycsb = "0.17.0" zero-allocation-hashing = "0.27ea0" -zstd = "1.5.6-7" +zstd = "1.5.6-8" [libraries] asm-bom = { module = "org.ow2.asm:asm-bom", version.ref = "asm" } @@ -107,7 +107,6 @@ bcel = { module = "org.apache.bcel:bcel", version.ref = "bcel" } bouncycastle-jdk18on = { module = "org.bouncycastle:bcprov-jdk18on", version.ref = "bouncycastle-jdk18on" } cache2k = { module = "org.cache2k:cache2k-core", version.ref = "cache2k" } caffeine = { module = "com.github.ben-manes.caffeine:caffeine", version.ref = "caffeine" } -checker-annotations = { module = "org.checkerframework:checker-qual", version.ref = "checker-framework" } checkstyle = { module = "com.puppycrawl.tools:checkstyle", version.ref = "checkstyle" } coherence = { module = "com.oracle.coherence.ce:coherence", version.ref = "coherence" } commons-collections4 = { module = "org.apache.commons:commons-collections4", version.ref = "commons-collections4" } @@ -160,6 +159,7 @@ jfreechart = { module = "org.jfree:jfreechart", version.ref = "jfreechart" } jgit = { module = "org.eclipse.jgit:org.eclipse.jgit", version.ref = "jgit" } jmh = { module = "org.openjdk.jmh:jmh-core", version.ref = "jmh" } joor = { module = "org.jooq:joor", version.ref = "joor" } +jspecify = { module = "org.jspecify:jspecify", version.ref = "jspecify" } json-bind = { module = "javax.json.bind:javax.json.bind-api", version.ref = "json-bind" } jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" } junit4 = { module = "junit:junit", version.ref = "junit4" } diff --git a/gradle/plugins/src/main/kotlin/lifecycle/java-library.caffeine.gradle.kts b/gradle/plugins/src/main/kotlin/lifecycle/java-library.caffeine.gradle.kts index f4279bcecd..5729dd717b 100644 --- a/gradle/plugins/src/main/kotlin/lifecycle/java-library.caffeine.gradle.kts +++ b/gradle/plugins/src/main/kotlin/lifecycle/java-library.caffeine.gradle.kts @@ -97,7 +97,7 @@ tasks.withType().configureEach { addStringOption("-release", javaVersion.toString()) addStringOption("-link-modularity-mismatch", "info") links( - "https://checkerframework.org/api/", + "https://jspecify.dev/docs/api/", "https://errorprone.info/api/latest/", "https://lightbend.github.io/config/latest/api/", "https://docs.oracle.com/en/java/javase/$javaVersion/docs/api/", diff --git a/guava/src/main/java/com/github/benmanes/caffeine/guava/CaffeinatedGuava.java b/guava/src/main/java/com/github/benmanes/caffeine/guava/CaffeinatedGuava.java index ae9d59c206..9f8b1c4285 100644 --- a/guava/src/main/java/com/github/benmanes/caffeine/guava/CaffeinatedGuava.java +++ b/guava/src/main/java/com/github/benmanes/caffeine/guava/CaffeinatedGuava.java @@ -17,6 +17,8 @@ import java.lang.reflect.Method; +import org.jspecify.annotations.NullMarked; + import com.github.benmanes.caffeine.cache.Caffeine; import com.github.benmanes.caffeine.guava.CaffeinatedGuavaLoadingCache.ExternalBulkLoader; import com.github.benmanes.caffeine.guava.CaffeinatedGuavaLoadingCache.ExternalSingleLoader; @@ -31,6 +33,7 @@ * * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked public final class CaffeinatedGuava { private CaffeinatedGuava() {} diff --git a/guava/src/main/java/com/github/benmanes/caffeine/guava/CaffeinatedGuavaCache.java b/guava/src/main/java/com/github/benmanes/caffeine/guava/CaffeinatedGuavaCache.java index 13efae59ed..833171da5a 100644 --- a/guava/src/main/java/com/github/benmanes/caffeine/guava/CaffeinatedGuavaCache.java +++ b/guava/src/main/java/com/github/benmanes/caffeine/guava/CaffeinatedGuavaCache.java @@ -29,7 +29,7 @@ import java.util.function.Function; import java.util.function.Predicate; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.google.common.cache.Cache; import com.google.common.cache.CacheLoader.InvalidCacheLoadException; diff --git a/guava/src/main/java/com/github/benmanes/caffeine/guava/CaffeinatedGuavaLoadingCache.java b/guava/src/main/java/com/github/benmanes/caffeine/guava/CaffeinatedGuavaLoadingCache.java index c428c3d804..5be56d477f 100644 --- a/guava/src/main/java/com/github/benmanes/caffeine/guava/CaffeinatedGuavaLoadingCache.java +++ b/guava/src/main/java/com/github/benmanes/caffeine/guava/CaffeinatedGuavaLoadingCache.java @@ -25,7 +25,7 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.Executor; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.CacheLoader; import com.google.common.cache.CacheLoader.InvalidCacheLoadException; diff --git a/guava/src/main/java/com/github/benmanes/caffeine/guava/package-info.java b/guava/src/main/java/com/github/benmanes/caffeine/guava/package-info.java index ca4d364dd3..4a851c30e1 100644 --- a/guava/src/main/java/com/github/benmanes/caffeine/guava/package-info.java +++ b/guava/src/main/java/com/github/benmanes/caffeine/guava/package-info.java @@ -19,14 +19,10 @@ * * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked @CheckReturnValue -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.FIELD) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.PARAMETER) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.RETURN) package com.github.benmanes.caffeine.guava; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.framework.qual.DefaultQualifier; -import org.checkerframework.framework.qual.TypeUseLocation; +import org.jspecify.annotations.NullMarked; import com.google.errorprone.annotations.CheckReturnValue; diff --git a/guava/src/main/java/module-info.java b/guava/src/main/java/module-info.java index 9558b39cc6..356cebcd0c 100644 --- a/guava/src/main/java/module-info.java +++ b/guava/src/main/java/module-info.java @@ -5,5 +5,5 @@ requires transitive com.google.common; requires static com.google.errorprone.annotations; - requires static org.checkerframework.checker.qual; + requires static org.jspecify; } diff --git a/guava/src/test/java/com/github/benmanes/caffeine/guava/compatibility/TestingCacheLoaders.java b/guava/src/test/java/com/github/benmanes/caffeine/guava/compatibility/TestingCacheLoaders.java index 844fdd3bec..a68bb3307d 100644 --- a/guava/src/test/java/com/github/benmanes/caffeine/guava/compatibility/TestingCacheLoaders.java +++ b/guava/src/test/java/com/github/benmanes/caffeine/guava/compatibility/TestingCacheLoaders.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; diff --git a/guava/src/test/java/com/github/benmanes/caffeine/guava/compatibility/package-info.java b/guava/src/test/java/com/github/benmanes/caffeine/guava/compatibility/package-info.java index ef87390580..8676507608 100644 --- a/guava/src/test/java/com/github/benmanes/caffeine/guava/compatibility/package-info.java +++ b/guava/src/test/java/com/github/benmanes/caffeine/guava/compatibility/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.guava.compatibility; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/guava/src/test/java/com/github/benmanes/caffeine/guava/package-info.java b/guava/src/test/java/com/github/benmanes/caffeine/guava/package-info.java index 5e7a01be5d..b3c9612491 100644 --- a/guava/src/test/java/com/github/benmanes/caffeine/guava/package-info.java +++ b/guava/src/test/java/com/github/benmanes/caffeine/guava/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.guava; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/jcache/build.gradle.kts b/jcache/build.gradle.kts index fd9433019d..5b5250d356 100644 --- a/jcache/build.gradle.kts +++ b/jcache/build.gradle.kts @@ -79,7 +79,7 @@ tasks.jar { "Automatic-Module-Name" to "com.github.benmanes.caffeine.jcache", "Bundle-SymbolicName" to "com.github.ben-manes.caffeine.jcache", "Import-Package" to listOf( - "!org.checkerframework.*", + "!org.jspecify.annotation.*", "!com.google.errorprone.annotations.*", "jakarta.inject.*;resolution:=\"optional\"", "*").joinToString(","), diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheFactory.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheFactory.java index 63c5d27860..6d6113a312 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheFactory.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheFactory.java @@ -30,7 +30,7 @@ import javax.cache.expiry.ExpiryPolicy; import javax.cache.integration.CacheLoader; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.Caffeine; import com.github.benmanes.caffeine.cache.Expiry; diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheManagerImpl.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheManagerImpl.java index 828540ba4e..32238fb5ca 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheManagerImpl.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheManagerImpl.java @@ -33,7 +33,7 @@ import javax.cache.configuration.Configuration; import javax.cache.spi.CachingProvider; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; /** * An implementation of JSR-107 {@link CacheManager} that manages Caffeine-based caches. diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java index a73f918fc0..33d5f18355 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java @@ -59,8 +59,7 @@ import javax.cache.processor.EntryProcessorException; import javax.cache.processor.EntryProcessorResult; -import org.checkerframework.checker.nullness.qual.Nullable; -import org.checkerframework.checker.nullness.qual.PolyNull; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.Ticker; import com.github.benmanes.caffeine.jcache.configuration.CaffeineConfiguration; @@ -1110,7 +1109,7 @@ protected final void requireNotClosed() { * @return a copy of the object if storing by value or the same instance if by reference */ @SuppressWarnings("NullAway") - protected final @PolyNull T copyOf(@PolyNull @Nullable T object) { + protected final T copyOf(@Nullable T object) { if (object == null) { return null; } @@ -1125,7 +1124,7 @@ protected final void requireNotClosed() { * @return a copy of the value if storing by value or the same instance if by reference */ @SuppressWarnings("NullAway") - protected final @PolyNull V copyValue(@PolyNull Expirable expirable) { + protected final V copyValue(@Nullable Expirable expirable) { if (expirable == null) { return null; } diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/LoadingCacheProxy.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/LoadingCacheProxy.java index 9c3efe979f..ce827306e9 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/LoadingCacheProxy.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/LoadingCacheProxy.java @@ -32,7 +32,7 @@ import javax.cache.integration.CacheLoader; import javax.cache.integration.CompletionListener; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.LoadingCache; import com.github.benmanes.caffeine.cache.Ticker; diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/CaffeineConfiguration.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/CaffeineConfiguration.java index 17faecc1bd..39aee128ee 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/CaffeineConfiguration.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/CaffeineConfiguration.java @@ -33,7 +33,8 @@ import javax.cache.integration.CacheLoader; import javax.cache.integration.CacheWriter; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.Expiry; import com.github.benmanes.caffeine.cache.Scheduler; @@ -53,6 +54,7 @@ * * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked public final class CaffeineConfiguration implements CompleteConfiguration { private static final Factory DISABLED_SCHEDULER = Scheduler::disabledScheduler; private static final Factory JAVA_COPIER = JavaSerializationCopier::new; @@ -606,7 +608,7 @@ public CaffeineConfiguration setWeigherFactory( } @Override - public boolean equals(Object o) { + public boolean equals(@Nullable Object o) { if (o == this) { return true; } else if (!(o instanceof CaffeineConfiguration)) { diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/ConfigSource.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/ConfigSource.java index 8d71f4822b..4c5d291302 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/ConfigSource.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/ConfigSource.java @@ -17,6 +17,8 @@ import java.net.URI; +import org.jspecify.annotations.NullMarked; + import com.typesafe.config.Config; /** @@ -24,6 +26,7 @@ * * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked @FunctionalInterface public interface ConfigSource { diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/FactoryCreator.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/FactoryCreator.java index bab337d86c..afb1abccfe 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/FactoryCreator.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/FactoryCreator.java @@ -17,11 +17,14 @@ import javax.cache.configuration.Factory; +import org.jspecify.annotations.NullMarked; + /** * An object capable of providing factories that produce an instance for a given class name. * * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked @FunctionalInterface public interface FactoryCreator { diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/TypesafeConfigurator.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/TypesafeConfigurator.java index a8e9963cb9..5f8b3871c8 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/TypesafeConfigurator.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/TypesafeConfigurator.java @@ -41,7 +41,8 @@ import javax.cache.expiry.EternalExpiryPolicy; import javax.cache.expiry.ExpiryPolicy; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.NullMarked; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.jcache.expiry.JCacheExpiryPolicy; import com.google.errorprone.annotations.Var; @@ -59,6 +60,7 @@ * * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked @SuppressWarnings({"PMD.AvoidDuplicateLiterals", "PMD.MutableStaticState"}) public final class TypesafeConfigurator { static final Logger logger = System.getLogger(TypesafeConfigurator.class.getName()); diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/package-info.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/package-info.java index 8326354ad1..d45ee11a63 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/package-info.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/configuration/package-info.java @@ -1,11 +1,7 @@ +@NullMarked @CheckReturnValue -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.FIELD) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.PARAMETER) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.RETURN) package com.github.benmanes.caffeine.jcache.configuration; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.framework.qual.DefaultQualifier; -import org.checkerframework.framework.qual.TypeUseLocation; +import org.jspecify.annotations.NullMarked; import com.google.errorprone.annotations.CheckReturnValue; diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/copy/AbstractCopier.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/copy/AbstractCopier.java index 2216c9fff0..c3bad515e4 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/copy/AbstractCopier.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/copy/AbstractCopier.java @@ -38,6 +38,8 @@ import java.util.function.Function; import java.util.regex.Pattern; +import org.jspecify.annotations.NullMarked; + /** * A skeleton implementation where subclasses provide the serialization strategy. Serialization is * not performed if the type is a known immutable, an array of known immutable types, or specially @@ -45,6 +47,7 @@ * * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked @SuppressWarnings({"ImmutableMemberCollection", "JavaUtilDate", "JdkObsolete"}) public abstract class AbstractCopier implements Copier { private static final Map, Function> JAVA_DEEP_COPY = Map.of(Date.class, diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/copy/Copier.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/copy/Copier.java index 31a9e154ac..c0706ded29 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/copy/Copier.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/copy/Copier.java @@ -15,12 +15,15 @@ */ package com.github.benmanes.caffeine.jcache.copy; +import org.jspecify.annotations.NullMarked; + /** * An object is copied when the cache is configured with storeByValue to guard against * mutations of the key or value. * * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked @FunctionalInterface public interface Copier { diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/copy/JavaSerializationCopier.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/copy/JavaSerializationCopier.java index 0bee8a1f13..f9e1ae0bcb 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/copy/JavaSerializationCopier.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/copy/JavaSerializationCopier.java @@ -31,6 +31,8 @@ import javax.cache.CacheException; +import org.jspecify.annotations.NullMarked; + /** * A strategy that uses Java serialization if a fast path approach is not applicable. *

@@ -40,6 +42,7 @@ * * @author ben.manes@gmail.com (Ben Manes) */ +@NullMarked public class JavaSerializationCopier extends AbstractCopier { public JavaSerializationCopier() { diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/copy/package-info.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/copy/package-info.java index 590a2760af..5aa6b49a90 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/copy/package-info.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/copy/package-info.java @@ -1,11 +1,7 @@ +@NullMarked @CheckReturnValue -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.FIELD) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.PARAMETER) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.RETURN) package com.github.benmanes.caffeine.jcache.copy; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.framework.qual.DefaultQualifier; -import org.checkerframework.framework.qual.TypeUseLocation; +import org.jspecify.annotations.NullMarked; import com.google.errorprone.annotations.CheckReturnValue; diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java index eefc170686..cdd9d839bd 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventDispatcher.java @@ -35,7 +35,7 @@ import javax.cache.event.CacheEntryListener; import javax.cache.event.EventType; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.google.errorprone.annotations.Var; @@ -67,8 +67,8 @@ public final class EventDispatcher { static final Logger logger = System.getLogger(EventDispatcher.class.getName()); - final ConcurrentMap, ConcurrentMap>> dispatchQueues; - final ThreadLocal>> pending; + final ConcurrentMap, ConcurrentMap>> dispatchQueues; + final ThreadLocal>> pending; final Executor executor; public EventDispatcher(Executor executor) { @@ -195,7 +195,7 @@ public void publishExpiredQuietly(Cache cache, K key, V value) { * published. */ public void awaitSynchronous() { - List> futures = pending.get(); + var futures = pending.get(); if (futures.isEmpty()) { return; } diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventTypeFilter.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventTypeFilter.java index 915e4910fc..6587736e0a 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventTypeFilter.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/EventTypeFilter.java @@ -28,6 +28,8 @@ import javax.cache.event.CacheEntryRemovedListener; import javax.cache.event.CacheEntryUpdatedListener; +import org.jspecify.annotations.Nullable; + /** * A filter that determines if the listener can process the event type before delegating to the * decorated filter. @@ -64,7 +66,7 @@ private boolean isCompatible(CacheEntryEvent event) { } @Override - public boolean equals(Object o) { + public boolean equals(@Nullable Object o) { if (o == this) { return true; } else if (!(o instanceof EventTypeFilter)) { diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/JCacheEntryEvent.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/JCacheEntryEvent.java index 0e62b8d977..e641296868 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/JCacheEntryEvent.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/JCacheEntryEvent.java @@ -24,7 +24,7 @@ import javax.cache.event.CacheEntryEvent; import javax.cache.event.EventType; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; /** * A cache event dispatched to a listener. diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/JCacheEvictionListener.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/JCacheEvictionListener.java index 856852c0e9..fadad57570 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/JCacheEvictionListener.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/JCacheEvictionListener.java @@ -19,7 +19,7 @@ import javax.cache.Cache; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.RemovalCause; import com.github.benmanes.caffeine.cache.RemovalListener; diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/Registration.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/Registration.java index c55ec09bb5..f00766ecf8 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/Registration.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/Registration.java @@ -22,6 +22,8 @@ import javax.cache.event.CacheEntryEventFilter; import javax.cache.event.CacheEntryListener; +import org.jspecify.annotations.Nullable; + /** * The registration of a {@link CacheEntryListener} for event dispatching. * @@ -61,7 +63,7 @@ public boolean isSynchronous() { } @Override - public boolean equals(Object o) { + public boolean equals(@Nullable Object o) { if (o == this) { return true; } else if (!(o instanceof Registration)) { diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/package-info.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/package-info.java index 99258f334a..cd52195a6f 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/package-info.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/event/package-info.java @@ -1,11 +1,7 @@ +@NullMarked @CheckReturnValue -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.FIELD) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.PARAMETER) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.RETURN) package com.github.benmanes.caffeine.jcache.event; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.framework.qual.DefaultQualifier; -import org.checkerframework.framework.qual.TypeUseLocation; +import org.jspecify.annotations.NullMarked; import com.google.errorprone.annotations.CheckReturnValue; diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/expiry/JCacheExpiryPolicy.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/expiry/JCacheExpiryPolicy.java index f1486970d4..9b70b55b39 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/expiry/JCacheExpiryPolicy.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/expiry/JCacheExpiryPolicy.java @@ -23,7 +23,7 @@ import javax.cache.expiry.Duration; import javax.cache.expiry.ExpiryPolicy; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; /** * A customized expiration policy. @@ -60,7 +60,7 @@ public Duration getExpiryForCreation() { } @Override - public boolean equals(Object o) { + public boolean equals(@Nullable Object o) { if (o == this) { return true; } else if (!(o instanceof ExpiryPolicy)) { diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/expiry/package-info.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/expiry/package-info.java index 287621f24f..9370bdeb3a 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/expiry/package-info.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/expiry/package-info.java @@ -1,11 +1,7 @@ +@NullMarked @CheckReturnValue -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.FIELD) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.PARAMETER) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.RETURN) package com.github.benmanes.caffeine.jcache.expiry; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.framework.qual.DefaultQualifier; -import org.checkerframework.framework.qual.TypeUseLocation; +import org.jspecify.annotations.NullMarked; import com.google.errorprone.annotations.CheckReturnValue; diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/integration/JCacheLoaderAdapter.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/integration/JCacheLoaderAdapter.java index 9d11aec47d..560b96d410 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/integration/JCacheLoaderAdapter.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/integration/JCacheLoaderAdapter.java @@ -29,7 +29,7 @@ import javax.cache.integration.CacheLoader; import javax.cache.integration.CacheLoaderException; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.Ticker; import com.github.benmanes.caffeine.jcache.CacheProxy; diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/integration/package-info.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/integration/package-info.java index 2ee221290d..960a1d344c 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/integration/package-info.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/integration/package-info.java @@ -1,11 +1,7 @@ +@NullMarked @CheckReturnValue -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.FIELD) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.PARAMETER) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.RETURN) package com.github.benmanes.caffeine.jcache.integration; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.framework.qual.DefaultQualifier; -import org.checkerframework.framework.qual.TypeUseLocation; +import org.jspecify.annotations.NullMarked; import com.google.errorprone.annotations.CheckReturnValue; diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/management/JCacheStatisticsMXBean.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/management/JCacheStatisticsMXBean.java index 859dbc36fd..509cd82e49 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/management/JCacheStatisticsMXBean.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/management/JCacheStatisticsMXBean.java @@ -20,8 +20,6 @@ import javax.cache.management.CacheStatisticsMXBean; -import org.checkerframework.checker.index.qual.NonNegative; - /** * Caffeine JCache statistics. * @@ -82,7 +80,7 @@ public float getCacheHitPercentage() { * * @param count the number of hits to record */ - public void recordHits(@NonNegative long count) { + public void recordHits(long count) { if (enabled) { hits.add(count); } @@ -105,7 +103,7 @@ public float getCacheMissPercentage() { * * @param count the number of misses to record */ - public void recordMisses(@NonNegative long count) { + public void recordMisses(long count) { if (enabled) { misses.add(count); } @@ -126,7 +124,7 @@ public long getCachePuts() { * * @param count the number of writes to record */ - public void recordPuts(@NonNegative long count) { + public void recordPuts(long count) { if (enabled && (count != 0)) { puts.add(count); } @@ -142,7 +140,7 @@ public long getCacheRemovals() { * * @param count the number of removals to record */ - public void recordRemovals(@NonNegative long count) { + public void recordRemovals(long count) { if (enabled) { removals.add(count); } @@ -158,7 +156,7 @@ public long getCacheEvictions() { * * @param count the number of evictions to record */ - public void recordEvictions(@NonNegative long count) { + public void recordEvictions(long count) { if (enabled) { evictions.add(count); } diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/management/package-info.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/management/package-info.java index 924b882947..bfa9b9e354 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/management/package-info.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/management/package-info.java @@ -1,11 +1,7 @@ +@NullMarked @CheckReturnValue -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.FIELD) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.PARAMETER) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.RETURN) package com.github.benmanes.caffeine.jcache.management; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.framework.qual.DefaultQualifier; -import org.checkerframework.framework.qual.TypeUseLocation; +import org.jspecify.annotations.NullMarked; import com.google.errorprone.annotations.CheckReturnValue; diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/package-info.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/package-info.java index 2e5866b425..a9077d3890 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/package-info.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/package-info.java @@ -1,11 +1,7 @@ +@NullMarked @CheckReturnValue -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.FIELD) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.PARAMETER) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.RETURN) package com.github.benmanes.caffeine.jcache; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.framework.qual.DefaultQualifier; -import org.checkerframework.framework.qual.TypeUseLocation; +import org.jspecify.annotations.NullMarked; import com.google.errorprone.annotations.CheckReturnValue; diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/processor/EntryProcessorEntry.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/processor/EntryProcessorEntry.java index 8c2639740f..cc937f8b24 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/processor/EntryProcessorEntry.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/processor/EntryProcessorEntry.java @@ -23,7 +23,7 @@ import javax.cache.processor.EntryProcessor; import javax.cache.processor.MutableEntry; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; /** * An entry that is consumed by an {@link EntryProcessor}. The updates to the entry are replayed diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/processor/package-info.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/processor/package-info.java index 784bafab93..d9612b40ab 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/processor/package-info.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/processor/package-info.java @@ -1,11 +1,7 @@ +@NullMarked @CheckReturnValue -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.FIELD) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.PARAMETER) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.RETURN) package com.github.benmanes.caffeine.jcache.processor; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.framework.qual.DefaultQualifier; -import org.checkerframework.framework.qual.TypeUseLocation; +import org.jspecify.annotations.NullMarked; import com.google.errorprone.annotations.CheckReturnValue; diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/spi/CaffeineCachingProvider.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/spi/CaffeineCachingProvider.java index bded9d9226..e64febf4f4 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/spi/CaffeineCachingProvider.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/spi/CaffeineCachingProvider.java @@ -33,7 +33,7 @@ import javax.cache.configuration.OptionalFeature; import javax.cache.spi.CachingProvider; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import org.osgi.service.component.annotations.Activate; import org.osgi.service.component.annotations.Component; diff --git a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/spi/package-info.java b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/spi/package-info.java index 3cda819cd5..dbf49aa509 100644 --- a/jcache/src/main/java/com/github/benmanes/caffeine/jcache/spi/package-info.java +++ b/jcache/src/main/java/com/github/benmanes/caffeine/jcache/spi/package-info.java @@ -1,11 +1,7 @@ +@NullMarked @CheckReturnValue -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.FIELD) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.PARAMETER) -@DefaultQualifier(value = NonNull.class, locations = TypeUseLocation.RETURN) package com.github.benmanes.caffeine.jcache.spi; -import org.checkerframework.checker.nullness.qual.NonNull; -import org.checkerframework.framework.qual.DefaultQualifier; -import org.checkerframework.framework.qual.TypeUseLocation; +import org.jspecify.annotations.NullMarked; import com.google.errorprone.annotations.CheckReturnValue; diff --git a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/AbstractJCacheTest.java b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/AbstractJCacheTest.java index 4f6871b333..59be4f1c5c 100644 --- a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/AbstractJCacheTest.java +++ b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/AbstractJCacheTest.java @@ -24,7 +24,7 @@ import javax.cache.integration.CacheLoader; import javax.cache.spi.CachingProvider; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import org.testng.annotations.AfterClass; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeClass; diff --git a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/configuration/package-info.java b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/configuration/package-info.java index 37d466184a..d45ee11a63 100644 --- a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/configuration/package-info.java +++ b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/configuration/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.jcache.configuration; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/copy/package-info.java b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/copy/package-info.java index 4b6aad596e..5aa6b49a90 100644 --- a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/copy/package-info.java +++ b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/copy/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.jcache.copy; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/event/package-info.java b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/event/package-info.java index 9b3c6707d8..cd52195a6f 100644 --- a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/event/package-info.java +++ b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/event/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.jcache.event; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/expiry/package-info.java b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/expiry/package-info.java index 31d27656a9..9370bdeb3a 100644 --- a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/expiry/package-info.java +++ b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/expiry/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.jcache.expiry; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/integration/package-info.java b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/integration/package-info.java index 785bbd147e..960a1d344c 100644 --- a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/integration/package-info.java +++ b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/integration/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.jcache.integration; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/issues/package-info.java b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/issues/package-info.java new file mode 100644 index 0000000000..59d7faccc7 --- /dev/null +++ b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/issues/package-info.java @@ -0,0 +1,7 @@ +@NullMarked +@CheckReturnValue +package com.github.benmanes.caffeine.jcache.issues; + +import org.jspecify.annotations.NullMarked; + +import com.google.errorprone.annotations.CheckReturnValue; diff --git a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/management/package-info.java b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/management/package-info.java index d3d6c07883..bfa9b9e354 100644 --- a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/management/package-info.java +++ b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/management/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.jcache.management; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/package-info.java b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/package-info.java index cfeead53ba..a9077d3890 100644 --- a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/package-info.java +++ b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.jcache; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/processor/package-info.java b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/processor/package-info.java index 59e0c1b095..d9612b40ab 100644 --- a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/processor/package-info.java +++ b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/processor/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.jcache.processor; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/size/package-info.java b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/size/package-info.java index 9bddc5d7f6..72cf354b38 100644 --- a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/size/package-info.java +++ b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/size/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.jcache.size; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/spi/package-info.java b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/spi/package-info.java index dcaba8edba..dbf49aa509 100644 --- a/jcache/src/test/java/com/github/benmanes/caffeine/jcache/spi/package-info.java +++ b/jcache/src/test/java/com/github/benmanes/caffeine/jcache/spi/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.jcache.spi; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/BasicSettings.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/BasicSettings.java index c300e38488..06b2ca9421 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/BasicSettings.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/BasicSettings.java @@ -26,7 +26,7 @@ import java.util.function.Function; import java.util.regex.Pattern; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.admission.Admission; import com.github.benmanes.caffeine.cache.simulator.membership.FilterType; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/clairvoyant/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/clairvoyant/package-info.java new file mode 100644 index 0000000000..6f6fa07b64 --- /dev/null +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/clairvoyant/package-info.java @@ -0,0 +1,7 @@ +@NullMarked +@CheckReturnValue +package com.github.benmanes.caffeine.cache.simulator.admission.clairvoyant; + +import org.jspecify.annotations.NullMarked; + +import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/countmin4/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/countmin4/package-info.java index 29a5355fe0..3ffc1de122 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/countmin4/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/countmin4/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.admission.countmin4; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/countmin64/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/countmin64/package-info.java index 2ae76e82fa..9defe7312b 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/countmin64/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/countmin64/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.admission.countmin64; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/package-info.java index 973e4d0881..46bb5dbaee 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.admission; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/perfect/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/perfect/package-info.java index 11990c5a01..bbc14a00e5 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/perfect/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/perfect/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.admission.perfect; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/table/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/table/package-info.java index 91c5f05966..13cb90aff6 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/table/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/table/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.admission.table; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/tinycache/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/tinycache/package-info.java index 566830198b..92fffac8ff 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/tinycache/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/admission/tinycache/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.admission.tinycache; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/membership/bloom/BloomFilter.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/membership/bloom/BloomFilter.java index 58a646162a..1cff5bf352 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/membership/bloom/BloomFilter.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/membership/bloom/BloomFilter.java @@ -19,8 +19,6 @@ import java.util.Arrays; -import org.checkerframework.checker.index.qual.NonNegative; - import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.membership.Membership; import com.google.errorprone.annotations.Var; @@ -68,7 +66,7 @@ public BloomFilter(Config config) { * @param fpp the false positive probability, where {@literal 0.0 > fpp < 1.0} */ @SuppressWarnings("Varifier") - public void ensureCapacity(@NonNegative long expectedInsertions, @NonNegative double fpp) { + public void ensureCapacity(long expectedInsertions, double fpp) { checkArgument(expectedInsertions >= 0); checkArgument(fpp > 0 && fpp < 1); diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/membership/bloom/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/membership/bloom/package-info.java index 114cb94d84..4ad210fe4f 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/membership/bloom/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/membership/bloom/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.membership.bloom; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/membership/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/membership/package-info.java index 25efd6de8c..f144e9ae8e 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/membership/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/membership/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.membership; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/package-info.java index ccf25988e9..254ed24d9a 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/AbstractTraceReader.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/AbstractTraceReader.java index 24fb97216c..f14fe70de2 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/AbstractTraceReader.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/AbstractTraceReader.java @@ -34,7 +34,7 @@ import org.apache.commons.compress.compressors.CompressorException; import org.apache.commons.compress.compressors.CompressorStreamFactory; import org.apache.commons.io.input.CloseShieldInputStream; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import org.tukaani.xz.XZInputStream; import com.google.common.base.Throwables; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/adapt_size/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/adapt_size/package-info.java index a9927b38e0..7dc6bbee82 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/adapt_size/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/adapt_size/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.adapt_size; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/address/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/address/package-info.java index 2883ffdf43..64b95f65ce 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/address/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/address/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.address; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/address/penalties/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/address/penalties/package-info.java index 39c149fec8..3c3aa40a21 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/address/penalties/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/address/penalties/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.address.penalties; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/arc/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/arc/package-info.java index 1b78db9d65..d4f0752741 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/arc/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/arc/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.arc; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/baleen/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/baleen/package-info.java index 4aba96f214..57293c18b0 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/baleen/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/baleen/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.baleen; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/cache2k/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/cache2k/package-info.java index d0822ce85a..857908ae08 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/cache2k/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/cache2k/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.cache2k; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/cachelib/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/cachelib/package-info.java index 2b48c98a10..0e1659eb87 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/cachelib/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/cachelib/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.cachelib; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/camelab/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/camelab/package-info.java index 944c709600..8995efc422 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/camelab/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/camelab/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.camelab; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/cloud_physics/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/cloud_physics/package-info.java index c92e6906e0..7961c1af4c 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/cloud_physics/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/cloud_physics/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.cloud_physics; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/corda/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/corda/package-info.java index 250868eb9d..66217ad508 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/corda/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/corda/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.corda; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/glcache/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/glcache/package-info.java index 8727e2f92f..41f33da682 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/glcache/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/glcache/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.glcache; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/gradle/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/gradle/package-info.java index 516488930f..bbe39383da 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/gradle/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/gradle/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.gradle; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/kaggle/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/kaggle/package-info.java index f2480baca1..6eb691e033 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/kaggle/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/kaggle/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.kaggle; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/libcachesim/csv/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/libcachesim/csv/package-info.java index c3ee916633..247b8ead68 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/libcachesim/csv/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/libcachesim/csv/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.libcachesim.csv; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/libcachesim/twitter/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/libcachesim/twitter/package-info.java index 2d6ff32c80..538926f988 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/libcachesim/twitter/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/libcachesim/twitter/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.libcachesim.twitter; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/lirs/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/lirs/package-info.java index 35a6d42362..bca5169f38 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/lirs/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/lirs/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.lirs; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/lrb/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/lrb/package-info.java index c9f6bcc61a..c7da3d502e 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/lrb/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/lrb/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.lrb; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/package-info.java index 44b4dd0eea..c4185a7386 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/scarab/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/scarab/package-info.java index 3c3a4b78e3..f7d182dad7 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/scarab/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/scarab/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.scarab; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/snia/cambridge/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/snia/cambridge/package-info.java index 32fb572e7f..56b257a09a 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/snia/cambridge/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/snia/cambridge/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.snia.cambridge; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/snia/enterprise/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/snia/enterprise/package-info.java index aa18824326..ee192436e5 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/snia/enterprise/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/snia/enterprise/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.snia.enterprise; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/snia/keyvalue/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/snia/keyvalue/package-info.java index 600dc967b3..65de42328f 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/snia/keyvalue/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/snia/keyvalue/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.snia.keyvalue; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/snia/parallel/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/snia/parallel/package-info.java index b537cc9881..fd73ae6080 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/snia/parallel/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/snia/parallel/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.snia.parallel; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/snia/systor/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/snia/systor/package-info.java index 6b9a72fa41..27456209fd 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/snia/systor/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/snia/systor/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.snia.systor; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/tragen/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/tragen/package-info.java index 732b965246..c40c1a47d0 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/tragen/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/tragen/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.tragen; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/twitter/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/twitter/package-info.java index 37d9812b67..671bfbb3ac 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/twitter/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/twitter/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.twitter; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/umass/network/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/umass/network/package-info.java index 3edda359fe..6d483f8b66 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/umass/network/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/umass/network/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.umass.network; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/umass/storage/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/umass/storage/package-info.java index 425ab334b0..da705d4dd6 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/umass/storage/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/umass/storage/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.umass.storage; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/wikipedia/WikipediaTraceReader.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/wikipedia/WikipediaTraceReader.java index d9ddf1ad58..5842cbbe8e 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/wikipedia/WikipediaTraceReader.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/wikipedia/WikipediaTraceReader.java @@ -19,7 +19,7 @@ import java.util.stream.LongStream; import org.apache.commons.lang3.StringUtils; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.parser.TextTraceReader; import com.github.benmanes.caffeine.cache.simulator.parser.TraceReader.KeyOnlyTraceReader; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/wikipedia/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/wikipedia/package-info.java index ce0b5ce205..76905c2fa0 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/wikipedia/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/parser/wikipedia/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.parser.wikipedia; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/AccessEvent.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/AccessEvent.java index 204105ee07..70922f213e 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/AccessEvent.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/AccessEvent.java @@ -19,6 +19,8 @@ import java.util.Objects; +import org.jspecify.annotations.Nullable; + import com.google.common.base.MoreObjects; import com.google.errorprone.annotations.Immutable; @@ -61,7 +63,7 @@ public boolean isPenaltyAware() { } @Override - public boolean equals(Object o) { + public boolean equals(@Nullable Object o) { if (o == this) { return true; } else if (!(o instanceof AccessEvent)) { diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/PolicyActor.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/PolicyActor.java index 428d3da9b6..97a112136e 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/PolicyActor.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/PolicyActor.java @@ -21,6 +21,8 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.Semaphore; +import org.jspecify.annotations.Nullable; + import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.google.common.collect.ImmutableList; @@ -30,12 +32,12 @@ * @author ben.manes@gmail.com (Ben Manes) */ public final class PolicyActor { - private final CompletableFuture completed; + private final CompletableFuture<@Nullable Void> completed; private final Semaphore semaphore; private final Policy policy; private final Thread parent; - private CompletableFuture future; + private CompletableFuture<@Nullable Void> future; /** * Creates an actor that executes the policy actions asynchronously over a buffered channel. @@ -63,7 +65,7 @@ public void finish() { } /** Return the future that signals the policy's completion. */ - public CompletableFuture completed() { + public CompletableFuture<@Nullable Void> completed() { return completed; } diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/adaptive/ArcPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/adaptive/ArcPolicy.java index a036b847ae..134395ba03 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/adaptive/ArcPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/adaptive/ArcPolicy.java @@ -17,7 +17,7 @@ import static com.google.common.base.Preconditions.checkState; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.policy.Policy.KeyOnlyPolicy; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/adaptive/CarPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/adaptive/CarPolicy.java index c002e9291f..7361fc94b2 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/adaptive/CarPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/adaptive/CarPolicy.java @@ -17,7 +17,7 @@ import static com.google.common.base.Preconditions.checkState; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.policy.Policy.KeyOnlyPolicy; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/adaptive/CartPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/adaptive/CartPolicy.java index a3841074a7..c459e217ef 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/adaptive/CartPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/adaptive/CartPolicy.java @@ -17,7 +17,7 @@ import static com.google.common.base.Preconditions.checkState; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.policy.Policy.KeyOnlyPolicy; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/adaptive/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/adaptive/package-info.java index 9dcd7bc606..f4b65d2e4b 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/adaptive/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/adaptive/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.policy.adaptive; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/greedy_dual/CampPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/greedy_dual/CampPolicy.java index eccfde2cba..587830ba25 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/greedy_dual/CampPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/greedy_dual/CampPolicy.java @@ -22,7 +22,7 @@ import java.util.Objects; import java.util.TreeSet; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.policy.AccessEvent; @@ -218,7 +218,7 @@ public int compareTo(Sentinel sentinel) { } @Override - public boolean equals(Object o) { + public boolean equals(@Nullable Object o) { if (this == o) { return true; } else if (!(o instanceof Sentinel)) { diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/greedy_dual/GDWheelPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/greedy_dual/GDWheelPolicy.java index a593aac63f..01079c4cc5 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/greedy_dual/GDWheelPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/greedy_dual/GDWheelPolicy.java @@ -18,7 +18,7 @@ import static com.github.benmanes.caffeine.cache.simulator.policy.Policy.Characteristic.WEIGHTED; import static com.google.common.base.Preconditions.checkState; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.policy.AccessEvent; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/greedy_dual/GdsfPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/greedy_dual/GdsfPolicy.java index af83c3a7df..f46b61a899 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/greedy_dual/GdsfPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/greedy_dual/GdsfPolicy.java @@ -23,6 +23,8 @@ import java.util.Set; import java.util.TreeSet; +import org.jspecify.annotations.Nullable; + import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.policy.AccessEvent; import com.github.benmanes.caffeine.cache.simulator.policy.Policy; @@ -204,7 +206,7 @@ public int compareTo(Node node) { } @Override - public boolean equals(Object o) { + public boolean equals(@Nullable Object o) { if (o == this) { return true; } else if (!(o instanceof Node)) { diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/greedy_dual/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/greedy_dual/package-info.java index 9044c5264d..7e18b55d04 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/greedy_dual/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/greedy_dual/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.policy.greedy_dual; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/ClockProPlusPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/ClockProPlusPolicy.java index ed5d80053f..e684a0ae14 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/ClockProPlusPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/ClockProPlusPolicy.java @@ -17,7 +17,7 @@ import static com.google.common.base.Preconditions.checkState; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.policy.Policy.KeyOnlyPolicy; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/ClockProPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/ClockProPolicy.java index 04dca61b91..b57aee8620 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/ClockProPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/ClockProPolicy.java @@ -17,7 +17,7 @@ import static com.google.common.base.Preconditions.checkState; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.policy.Policy.KeyOnlyPolicy; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/DClockPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/DClockPolicy.java index 22ae3cd117..d5309d5df2 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/DClockPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/DClockPolicy.java @@ -22,7 +22,7 @@ import java.util.List; import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.policy.Policy; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/FrdPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/FrdPolicy.java index 28118dae60..9be61f96ee 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/FrdPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/FrdPolicy.java @@ -17,7 +17,7 @@ import static com.google.common.base.Preconditions.checkState; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.policy.Policy.KeyOnlyPolicy; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/HillClimberFrdPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/HillClimberFrdPolicy.java index 2a5a5ca4ae..087ffb3ae3 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/HillClimberFrdPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/HillClimberFrdPolicy.java @@ -17,7 +17,7 @@ import static com.google.common.base.Preconditions.checkState; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.policy.Policy.KeyOnlyPolicy; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/IndicatorFrdPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/IndicatorFrdPolicy.java index a33f5ceb56..c1d829fc5c 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/IndicatorFrdPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/IndicatorFrdPolicy.java @@ -17,7 +17,7 @@ import static com.google.common.base.Preconditions.checkState; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.policy.Policy.KeyOnlyPolicy; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/LirsPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/LirsPolicy.java index 18e7be7127..38d52c5b8f 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/LirsPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/LirsPolicy.java @@ -20,7 +20,7 @@ import java.util.ArrayList; import java.util.List; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.policy.Policy.KeyOnlyPolicy; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/package-info.java index 5c1f5dec6c..cd27df88b4 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/irr/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.policy.irr; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/FrequentlyUsedPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/FrequentlyUsedPolicy.java index 202d62caa9..149a1c5d73 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/FrequentlyUsedPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/FrequentlyUsedPolicy.java @@ -22,7 +22,7 @@ import java.util.Set; import org.apache.commons.lang3.StringUtils; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.admission.Admission; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/LinkedPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/LinkedPolicy.java index 1d4423b554..b801d0a630 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/LinkedPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/LinkedPolicy.java @@ -22,7 +22,7 @@ import java.util.Set; import org.apache.commons.lang3.StringUtils; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.admission.Admission; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/MultiQueuePolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/MultiQueuePolicy.java index da09e306aa..945bdc06d3 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/MultiQueuePolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/MultiQueuePolicy.java @@ -19,7 +19,7 @@ import java.util.Arrays; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.policy.Policy.KeyOnlyPolicy; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/S4LruPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/S4LruPolicy.java index b69adba496..8d4da717ab 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/S4LruPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/S4LruPolicy.java @@ -21,7 +21,7 @@ import java.util.Arrays; import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.admission.Admission; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/package-info.java index 3eb8cba267..7444af06a8 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/linked/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.policy.linked; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/opt/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/opt/package-info.java index 334c9e3a68..fac924fb6a 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/opt/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/opt/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.policy.opt; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/package-info.java index c9b2a6974a..55fb513cea 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.policy; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/product/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/product/package-info.java index 0a5e777d6f..51ecf285f7 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/product/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/product/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.policy.product; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sampled/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sampled/package-info.java index d0993888d2..fdb33401ef 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sampled/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sampled/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.policy.sampled; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/WindowTinyLfuPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/WindowTinyLfuPolicy.java index a96b5914a8..96d728cfaf 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/WindowTinyLfuPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/WindowTinyLfuPolicy.java @@ -21,7 +21,7 @@ import java.util.List; import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.admission.Admission; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/HillClimberWindowTinyLfuPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/HillClimberWindowTinyLfuPolicy.java index 0a7c760a9c..f8be96c951 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/HillClimberWindowTinyLfuPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/HillClimberWindowTinyLfuPolicy.java @@ -28,7 +28,7 @@ import java.util.List; import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.admission.Admission; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/gradient/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/gradient/package-info.java index 8d78ebb0ed..6880da9141 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/gradient/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/gradient/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.policy.sketch.climbing.gradient; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/hill/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/hill/package-info.java index 9b128a21f5..a86bc21321 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/hill/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/hill/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.policy.sketch.climbing.hill; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/inference/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/inference/package-info.java index f84a278b5f..1cb926a6da 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/inference/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/inference/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.policy.sketch.climbing.inference; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/package-info.java index b0d70d138f..dc7b3b4abc 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.policy.sketch.climbing; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/sim/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/sim/package-info.java index 04af759b70..93f6ea29cb 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/sim/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/climbing/sim/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.policy.sketch.climbing.sim; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/feedback/FeedbackTinyLfuPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/feedback/FeedbackTinyLfuPolicy.java index 34d2e34c76..02623a2b77 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/feedback/FeedbackTinyLfuPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/feedback/FeedbackTinyLfuPolicy.java @@ -19,7 +19,7 @@ import java.util.Map; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.admission.Admission; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/feedback/FeedbackWindowTinyLfuPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/feedback/FeedbackWindowTinyLfuPolicy.java index 4a99714b24..310044509e 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/feedback/FeedbackWindowTinyLfuPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/feedback/FeedbackWindowTinyLfuPolicy.java @@ -23,7 +23,7 @@ import java.util.Map; import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.admission.Admission; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/feedback/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/feedback/package-info.java index 7c607901db..5a0d3ceb9d 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/feedback/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/feedback/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.policy.sketch.feedback; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/package-info.java index 2a1bec52d5..766fe3d97a 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.policy.sketch; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/FullySegmentedWindowTinyLfuPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/FullySegmentedWindowTinyLfuPolicy.java index 532a942b97..cab36c130c 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/FullySegmentedWindowTinyLfuPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/FullySegmentedWindowTinyLfuPolicy.java @@ -21,7 +21,7 @@ import java.util.List; import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.admission.Admission; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/LruWindowTinyLfuPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/LruWindowTinyLfuPolicy.java index 8d11d526bd..d21f5eb9b5 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/LruWindowTinyLfuPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/LruWindowTinyLfuPolicy.java @@ -21,7 +21,7 @@ import java.util.List; import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.admission.Admission; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/S4WindowTinyLfuPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/S4WindowTinyLfuPolicy.java index 3aab28286d..9cfa54db45 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/S4WindowTinyLfuPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/S4WindowTinyLfuPolicy.java @@ -22,7 +22,7 @@ import java.util.List; import java.util.Set; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.admission.Admission; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/package-info.java index 007fbd2a50..ed38a397d8 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/segment/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.policy.sketch.segment; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/tinycache/WindowTinyCachePolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/tinycache/WindowTinyCachePolicy.java index 4dcf451810..b939dc7def 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/tinycache/WindowTinyCachePolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/tinycache/WindowTinyCachePolicy.java @@ -15,7 +15,7 @@ */ package com.github.benmanes.caffeine.cache.simulator.policy.sketch.tinycache; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.admission.tinycache.TinyCache; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/tinycache/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/tinycache/package-info.java index 6923e34859..f3bc67a50c 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/tinycache/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/sketch/tinycache/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.policy.sketch.tinycache; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/two_queue/S3FifoPolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/two_queue/S3FifoPolicy.java index cc424dff84..4d02ad3607 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/two_queue/S3FifoPolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/two_queue/S3FifoPolicy.java @@ -21,7 +21,7 @@ import java.util.LinkedHashSet; import java.util.function.IntConsumer; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.policy.AccessEvent; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/two_queue/TuQueuePolicy.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/two_queue/TuQueuePolicy.java index cda39edd49..481febfb95 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/two_queue/TuQueuePolicy.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/two_queue/TuQueuePolicy.java @@ -17,7 +17,7 @@ import static com.google.common.base.Preconditions.checkState; -import org.checkerframework.checker.nullness.qual.Nullable; +import org.jspecify.annotations.Nullable; import com.github.benmanes.caffeine.cache.simulator.BasicSettings; import com.github.benmanes.caffeine.cache.simulator.policy.Policy.KeyOnlyPolicy; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/two_queue/package-info.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/two_queue/package-info.java index 0cecb81a77..1e0f50243e 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/two_queue/package-info.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/policy/two_queue/package-info.java @@ -1,4 +1,7 @@ +@NullMarked @CheckReturnValue package com.github.benmanes.caffeine.cache.simulator.policy.two_queue; +import org.jspecify.annotations.NullMarked; + import com.google.errorprone.annotations.CheckReturnValue; diff --git a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/report/csv/CombinedCsvReport.java b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/report/csv/CombinedCsvReport.java index 329b76d5cd..89e793b7a3 100644 --- a/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/report/csv/CombinedCsvReport.java +++ b/simulator/src/main/java/com/github/benmanes/caffeine/cache/simulator/report/csv/CombinedCsvReport.java @@ -26,6 +26,8 @@ import java.util.TreeMap; import java.util.stream.Stream; +import org.jspecify.annotations.Nullable; + import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSortedMap; import com.univocity.parsers.csv.CsvParser; @@ -113,7 +115,7 @@ private static final class Label implements Comparable