Skip to content

Commit d884a31

Browse files
authored
Remove some unneeded suppressions (#1835)
1 parent 8ea5cad commit d884a31

File tree

12 files changed

+7
-16
lines changed

12 files changed

+7
-16
lines changed

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

-1
Original file line numberDiff line numberDiff line change
@@ -3070,7 +3070,6 @@ public boolean equals(@Nullable Object o) {
30703070
}
30713071

30723072
@Override
3073-
@SuppressWarnings("NullAway")
30743073
public int hashCode() {
30753074
@Var int hash = 0;
30763075
long now = expirationTicker().read();

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

-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ static Duration parseIsoDuration(String key, String value) {
320320

321321
/** Returns a parsed duration using the simple time unit format. */
322322
static Duration parseSimpleDuration(String key, String value) {
323-
@SuppressWarnings("NullAway")
324323
long duration = parseLong(key, value.substring(0, value.length() - 1));
325324
TimeUnit unit = parseTimeUnit(key, value);
326325
return Duration.ofNanos(unit.toNanos(duration));

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

-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ public boolean isAsync() {
103103
}
104104

105105
@Override
106-
@SuppressWarnings("NullAway")
107106
public @Nullable Expiry<K, V> expiry() {
108107
return null;
109108
}

caffeine/src/test/java/com/github/benmanes/caffeine/cache/AsyncCacheTest.java

-1
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,6 @@ public void getAllFunction_iterable_empty(AsyncCache<Int, Int> cache, CacheConte
427427
assertThat(result).isExhaustivelyEmpty();
428428
}
429429

430-
@SuppressWarnings("NullAway")
431430
@Test(dataProvider = "caches")
432431
@CacheSpec(removalListener = { Listener.DISABLED, Listener.REJECTING })
433432
public void getAllFunction_nullLookup(AsyncCache<Int, Int> cache, CacheContext context) {

caffeine/src/test/java/com/github/benmanes/caffeine/testing/MapSubject.java

-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ public MapSubject(FailureMetadata metadata, @Nullable Map<?, ?> subject) {
4444
this.actual = subject;
4545
}
4646

47-
@SuppressWarnings("NullAway")
4847
public static Factory<MapSubject, Map<?, ?>> map() {
4948
return MapSubject::new;
5049
}

guava/src/main/java/com/github/benmanes/caffeine/guava/CaffeinatedGuavaCache.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class CaffeinatedGuavaCache<K, V> implements Cache<K, V>, Serializable {
6565
}
6666

6767
@Override
68-
@SuppressWarnings({"NullAway", "PMD.ExceptionAsFlowControl", "PMD.PreserveStackTrace"})
68+
@SuppressWarnings({"PMD.ExceptionAsFlowControl", "PMD.PreserveStackTrace"})
6969
public V get(K key, Callable<? extends V> valueLoader) throws ExecutionException {
7070
requireNonNull(valueLoader);
7171
try {

guava/src/main/java/com/github/benmanes/caffeine/guava/CaffeinatedGuavaLoadingCache.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ final class CaffeinatedGuavaLoadingCache<K, V>
5757
}
5858

5959
@Override
60-
@SuppressWarnings({"NullAway", "PMD.PreserveStackTrace"})
60+
@SuppressWarnings("PMD.PreserveStackTrace")
6161
public V get(K key) throws ExecutionException {
6262
requireNonNull(key);
6363
try {
@@ -74,7 +74,7 @@ public V get(K key) throws ExecutionException {
7474
}
7575

7676
@Override
77-
@SuppressWarnings({"CatchingUnchecked", "NullAway",
77+
@SuppressWarnings({"CatchingUnchecked",
7878
"PMD.AvoidCatchingNPE", "PMD.PreserveStackTrace"})
7979
public V getUnchecked(K key) {
8080
try {
@@ -117,7 +117,7 @@ public ImmutableMap<K, V> getAll(Iterable<? extends K> keys) throws ExecutionExc
117117
}
118118

119119
@Override
120-
@SuppressWarnings({"deprecation", "NullAway"})
120+
@SuppressWarnings("deprecation")
121121
public V apply(K key) {
122122
return cache.get(key);
123123
}

guava/src/test/java/com/github/benmanes/caffeine/guava/GuavaMapTests.java

-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ public static Test suite() {
4040
return cache.asMap();
4141
})));
4242
suite.addTest(MapTestFactory.suite("GuavaLoadingView", generator(() -> {
43-
@SuppressWarnings("NullAway")
4443
Cache<String, String> cache = CaffeinatedGuava.build(
4544
Caffeine.newBuilder().maximumSize(Long.MAX_VALUE),
4645
key -> { throw new AssertionError(); });

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

-2
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,6 @@ public Map<K, V> getAll(Set<? extends K> keys) {
213213
*/
214214
protected Map<K, Expirable<V>> getAndFilterExpiredEntries(
215215
Set<? extends K> keys, boolean updateAccessTime) {
216-
// NullAway does not yet understand the @NonNull annotation in the return type of getAllPresent.
217-
@SuppressWarnings("NullAway")
218216
var result = new HashMap<K, Expirable<V>>(cache.getAllPresent(keys));
219217

220218
int[] expired = { 0 };

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

-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ public void loadAll(Set<? extends K> keys, boolean replaceExistingValues,
165165
var future = CompletableFuture.runAsync(() -> {
166166
try {
167167
if (replaceExistingValues) {
168-
@SuppressWarnings("NullAway")
169168
Map<K, V> loaded = cacheLoader.orElseThrow().loadAll(keys);
170169
for (var entry : loaded.entrySet()) {
171170
putNoCopyOrAwait(entry.getKey(), entry.getValue(), /* publishToWriter= */ false);

jcache/src/main/java/com/github/benmanes/caffeine/jcache/copy/AbstractCopier.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
* @author [email protected] (Ben Manes)
4949
*/
5050
@NullMarked
51-
@SuppressWarnings({"ImmutableMemberCollection", "JavaUtilDate", "JdkObsolete"})
51+
@SuppressWarnings({"ImmutableMemberCollection", "JavaUtilDate"})
5252
public abstract class AbstractCopier<A> implements Copier {
5353
private static final Map<Class<?>, Function<Object, Object>> JAVA_DEEP_COPY = Map.of(Date.class,
5454
o -> ((Date) o).clone(), GregorianCalendar.class, o -> ((GregorianCalendar) o).clone());

jcache/src/test/java/com/github/benmanes/caffeine/jcache/copy/JavaSerializationCopierTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -123,14 +123,14 @@ public void canDeeplyCopy() {
123123
}
124124

125125
@Test(dataProvider = "copier")
126-
@SuppressWarnings({"JavaUtilDate", "JdkObsolete", "UndefinedEquals"})
126+
@SuppressWarnings({"JavaUtilDate", "UndefinedEquals"})
127127
public void deepCopy_date(Copier copier) {
128128
var date = new Date();
129129
assertThat(copy(copier, date)).isEqualTo(date);
130130
}
131131

132132
@Test(dataProvider = "copier")
133-
@SuppressWarnings({"JavaUtilDate", "JdkObsolete"})
133+
@SuppressWarnings("JavaUtilDate")
134134
public void deepCopy_calendar(Copier copier) {
135135
var calendar = Calendar.getInstance(TimeZone.getTimeZone("UTC"), US);
136136
calendar.setTime(new Date());

0 commit comments

Comments
 (0)