diff options
Diffstat (limited to 'guava-tests/test/com/google/common/cache/TestingCacheLoaders.java')
-rw-r--r-- | guava-tests/test/com/google/common/cache/TestingCacheLoaders.java | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/guava-tests/test/com/google/common/cache/TestingCacheLoaders.java b/guava-tests/test/com/google/common/cache/TestingCacheLoaders.java index e4a06c9cb..3b09ed541 100644 --- a/guava-tests/test/com/google/common/cache/TestingCacheLoaders.java +++ b/guava-tests/test/com/google/common/cache/TestingCacheLoaders.java @@ -21,9 +21,11 @@ import com.google.common.annotations.GwtIncompatible; import com.google.common.collect.Maps; import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.ListenableFuture; + import java.util.Map; import java.util.concurrent.atomic.AtomicInteger; -import org.checkerframework.checker.nullness.qual.Nullable; + +import javax.annotation.Nullable; /** * Utility {@link CacheLoader} implementations intended for use in testing. @@ -56,17 +58,23 @@ class TestingCacheLoaders { }; } - /** Returns a {@link CacheLoader} that returns the given {@code constant} for every request. */ + /** + * Returns a {@link CacheLoader} that returns the given {@code constant} for every request. + */ static <K, V> ConstantLoader<K, V> constantLoader(@Nullable V constant) { - return new ConstantLoader<>(constant); + return new ConstantLoader<K, V>(constant); } - /** Returns a {@link CacheLoader} that returns the given {@code constant} for every request. */ + /** + * Returns a {@link CacheLoader} that returns the given {@code constant} for every request. + */ static IncrementingLoader incrementingLoader() { return new IncrementingLoader(); } - /** Returns a {@link CacheLoader} that throws the given error for every request. */ + /** + * Returns a {@link CacheLoader} that throws the given error for every request. + */ static <K, V> CacheLoader<K, V> errorLoader(final Error e) { checkNotNull(e); return new CacheLoader<K, V>() { @@ -77,7 +85,9 @@ class TestingCacheLoaders { }; } - /** Returns a {@link CacheLoader} that throws the given exception for every request. */ + /** + * Returns a {@link CacheLoader} that throws the given exception for every request. + */ static <K, V> CacheLoader<K, V> exceptionLoader(final Exception e) { checkNotNull(e); return new CacheLoader<K, V>() { @@ -88,7 +98,9 @@ class TestingCacheLoaders { }; } - /** Returns a {@link CacheLoader} that returns the key for every request. */ + /** + * Returns a {@link CacheLoader} that returns the key for every request. + */ static <T> IdentityLoader<T> identityLoader() { return new IdentityLoader<T>(); } @@ -140,7 +152,7 @@ class TestingCacheLoaders { return key; } - @GwtIncompatible // reload + @GwtIncompatible("reload") @Override public ListenableFuture<Integer> reload(Integer key, Integer oldValue) { countReload.incrementAndGet(); |