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 a368eb2fb2..18a4b30099 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 @@ -1193,12 +1193,6 @@ public int size() { return data.size(); } - /** - * Returns the number of mappings. The value returned is an estimate; the actual count may differ - * if there are concurrent insertions or removals. - * - * @return the number of mappings - */ @Override public long estimatedSize() { return data.mappingCount(); diff --git a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Policy.java b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Policy.java index 15247f03d5..c77c09edc6 100644 --- a/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Policy.java +++ b/caffeine/src/main/java/com/github/benmanes/caffeine/cache/Policy.java @@ -131,8 +131,8 @@ interface Eviction { * Note that some implementations may have an internal inherent bound on the maximum total size. * If the value specified exceeds that bound, then the value is set to the internal maximum. * - * @param maximum the maximum, interpreted as weighted or unweighted size depending on the - * whether how this cache was constructed + * @param maximum the maximum, interpreted as weighted or unweighted size depending on how this + * cache was constructed * @throws IllegalArgumentException if the maximum size specified is negative */ void setMaximum(@Nonnegative long maximum); diff --git a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/EvictionTest.java b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/EvictionTest.java index 85d1c023d2..b5ff1b0bda 100644 --- a/caffeine/src/test/java/com/github/benmanes/caffeine/cache/EvictionTest.java +++ b/caffeine/src/test/java/com/github/benmanes/caffeine/cache/EvictionTest.java @@ -214,8 +214,8 @@ public void evict_weighted_async(AsyncLoadingCache cache, ready.set(true); Awaits.await().untilTrue(done); - assertThat(eviction.weightedSize().getAsLong(), is(10L)); - assertThat(cache.synchronous().estimatedSize(), is(2L)); + Awaits.await().until(() -> eviction.weightedSize().getAsLong(), is(10L)); + Awaits.await().until(() -> cache.synchronous().estimatedSize(), is(2L)); assertThat(context, hasRemovalNotifications(context, 1, RemovalCause.SIZE)); verifyWriter(context, (verifier, writer) -> verifier.deletions(1, RemovalCause.SIZE)); } @@ -240,8 +240,8 @@ public void evict_zero_async(AsyncLoadingCache> cache, ready.set(true); Awaits.await().untilTrue(done); - assertThat(eviction.weightedSize().getAsLong(), is(0L)); - assertThat(cache.synchronous().estimatedSize(), is(0L)); + Awaits.await().until(() -> eviction.weightedSize().getAsLong(), is(0L)); + Awaits.await().until(() -> cache.synchronous().estimatedSize(), is(0L)); assertThat(context, hasRemovalNotifications(context, 1, RemovalCause.SIZE)); verifyWriter(context, (verifier, writer) -> verifier.deletions(1, RemovalCause.SIZE)); @@ -349,8 +349,8 @@ public void put_asyncWeight(AsyncLoadingCache> cache, ready.set(true); Awaits.await().untilTrue(done); - assertThat(eviction.weightedSize().getAsLong(), is(5L)); - assertThat(cache.synchronous().estimatedSize(), is(1L)); + Awaits.await().until(() -> eviction.weightedSize().getAsLong(), is(5L)); + Awaits.await().until(() -> cache.synchronous().estimatedSize(), is(1L)); } @Test(dataProvider = "caches") diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 8adacb8ac6..3d591961a7 100644 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -32,7 +32,7 @@ ext { error_prone_annotations: '2.0.8', flip_tables: '1.0.2', guava: '19.0', - javapoet: '1.6.0', + javapoet: '1.6.1', jcache: '1.0.0', jsr305: '3.0.1', stream: '2.9.1', diff --git a/guava/src/test/java/com/google/common/cache/TestingCacheLoaders.java b/guava/src/test/java/com/google/common/cache/TestingCacheLoaders.java index 282dc3de6e..a1654e724a 100644 --- a/guava/src/test/java/com/google/common/cache/TestingCacheLoaders.java +++ b/guava/src/test/java/com/google/common/cache/TestingCacheLoaders.java @@ -22,7 +22,6 @@ import javax.annotation.Nullable; -import com.github.benmanes.caffeine.base.UnsafeAccess; import com.google.common.annotations.GwtCompatible; import com.google.common.annotations.GwtIncompatible; import com.google.common.collect.Maps; @@ -94,9 +93,8 @@ static CacheLoader exceptionLoader(final Exception e) { checkNotNull(e); return new CacheLoader() { @Override - public V load(K key) { - UnsafeAccess.UNSAFE.throwException(e); - return null; // impossible + public V load(K key) throws Exception { + throw e; } }; }