Skip to content

Commit b0264b9

Browse files
committed
remove unnecessary @CanIgnoreReturnValue usages for stricter checking
1 parent e0963ed commit b0264b9

File tree

5 files changed

+9
-14
lines changed

5 files changed

+9
-14
lines changed

caffeine/src/main/java/com/github/benmanes/caffeine/cache/LocalAsyncCache.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,6 @@ final class AsyncBulkCompleter<K, V> implements BiFunction<
260260
throw new CompletionException(failure);
261261
}
262262

263-
@CanIgnoreReturnValue
264263
public CompletionException error(Throwable error) {
265264
long loadTime = cache.statsTicker().read() - startTime;
266265
var failure = handleResponse(/* result= */ null, error);

jcache/src/main/java/com/github/benmanes/caffeine/jcache/CacheProxy.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,6 @@ public void putAll(Map<? extends K, ? extends V> map) {
444444
}
445445

446446
@Override
447-
@CanIgnoreReturnValue
448447
public boolean putIfAbsent(K key, V value) {
449448
requireNotClosed();
450449
requireNonNull(value);
@@ -509,7 +508,6 @@ private boolean putIfAbsentNoAwait(K key, V value, boolean publishToWriter) {
509508
}
510509

511510
@Override
512-
@CanIgnoreReturnValue
513511
public boolean remove(K key) {
514512
requireNotClosed();
515513
requireNonNull(key);
@@ -622,7 +620,6 @@ public V getAndRemove(K key) {
622620
}
623621

624622
@Override
625-
@CanIgnoreReturnValue
626623
public boolean replace(K key, V oldValue, V newValue) {
627624
requireNotClosed();
628625
requireNonNull(oldValue);
@@ -675,7 +672,6 @@ public boolean replace(K key, V oldValue, V newValue) {
675672
}
676673

677674
@Override
678-
@CanIgnoreReturnValue
679675
public boolean replace(K key, V value) {
680676
requireNotClosed();
681677
boolean statsEnabled = statistics.isEnabled();

jcache/src/test/java/com/github/benmanes/caffeine/jcache/expiry/JCacheCombinedExpiryTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public void put_expired() {
109109

110110
@Test
111111
public void putIfAbsent_expired() {
112-
jcache.putIfAbsent(KEY_1, VALUE_1);
112+
assertThat(jcache.putIfAbsent(KEY_1, VALUE_1)).isTrue();
113113
advancePastExpiry();
114114

115115
assertThat(jcache.putIfAbsent(KEY_1, VALUE_2)).isTrue();

jcache/src/test/java/com/github/benmanes/caffeine/jcache/expiry/JCacheCreationExpiryTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ public void putAll_present() {
245245

246246
@Test
247247
public void putIfAbsent_absent() {
248-
jcache.putIfAbsent(KEY_1, VALUE_1);
248+
assertThat(jcache.putIfAbsent(KEY_1, VALUE_1)).isTrue();
249249

250250
Expirable<Integer> expirable = getExpirable(jcache, KEY_1);
251251
assertThat(expirable).isNotNull();
@@ -255,7 +255,7 @@ public void putIfAbsent_absent() {
255255

256256
@Test
257257
public void putIfAbsent_expired() {
258-
jcache.putIfAbsent(KEY_1, VALUE_1);
258+
assertThat(jcache.putIfAbsent(KEY_1, VALUE_1)).isTrue();
259259
advancePastExpiry();
260260

261261
assertThat(jcache.putIfAbsent(KEY_1, VALUE_2)).isTrue();
@@ -268,18 +268,18 @@ public void putIfAbsent_expired() {
268268

269269
@Test
270270
public void putIfAbsent_expired_lazy() {
271-
jcache.putIfAbsent(KEY_1, VALUE_1);
271+
assertThat(jcache.putIfAbsent(KEY_1, VALUE_1)).isTrue();
272272

273273
ticker.setAutoIncrementStep(EXPIRY_DURATION.dividedBy(2));
274274
assertThat(jcache.putIfAbsent(KEY_1, VALUE_2)).isTrue();
275275
}
276276

277277
@Test
278278
public void putIfAbsent_present() {
279-
jcache.putIfAbsent(KEY_1, VALUE_1);
279+
assertThat(jcache.putIfAbsent(KEY_1, VALUE_1)).isTrue();
280280
advanceHalfExpiry();
281281

282-
jcache.putIfAbsent(KEY_1, VALUE_2);
282+
assertThat(jcache.putIfAbsent(KEY_1, VALUE_2)).isFalse();
283283
Expirable<Integer> expirable = getExpirable(jcache, KEY_1);
284284
assertThat(expirable).isNotNull();
285285
assertThat(expirable.getExpireTimeMillis())

jcache/src/test/java/com/github/benmanes/caffeine/jcache/expiry/JCacheUpdateExpiryTest.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ public void put() {
110110
jcache.put(KEY_1, VALUE_2);
111111
Expirable<Integer> expirable = getExpirable(jcache, KEY_1);
112112
assertThat(expirable).isNotNull();
113-
assertThat(expirable.getExpireTimeMillis()
114-
).isEqualTo(currentTime().plus(EXPIRY_DURATION).toMillis());
113+
assertThat(expirable.getExpireTimeMillis())
114+
.isEqualTo(currentTime().plus(EXPIRY_DURATION).toMillis());
115115
}
116116

117117
@Test
@@ -133,7 +133,7 @@ public void replace() {
133133
jcache.put(KEY_1, VALUE_1);
134134
advanceHalfExpiry();
135135

136-
jcache.replace(KEY_1, VALUE_2);
136+
assertThat(jcache.replace(KEY_1, VALUE_2)).isTrue();
137137
Expirable<Integer> expirable = getExpirable(jcache, KEY_1);
138138
assertThat(expirable).isNotNull();
139139
assertThat(expirable.getExpireTimeMillis())

0 commit comments

Comments
 (0)