diff --git a/spring-core/src/main/java/org/springframework/util/ConcurrentLruCache.java b/spring-core/src/main/java/org/springframework/util/ConcurrentLruCache.java index 33b827ca1c9b..38dffe5d8faf 100644 --- a/spring-core/src/main/java/org/springframework/util/ConcurrentLruCache.java +++ b/spring-core/src/main/java/org/springframework/util/ConcurrentLruCache.java @@ -47,7 +47,6 @@ * @param the type of the cached values, does not allow null values * @see #get(Object) */ -@SuppressWarnings({"unchecked", "NullAway"}) public final class ConcurrentLruCache { private final int capacity; @@ -388,16 +387,15 @@ private static final class ReadOperations { // Number of operations processed, for each buffer private final AtomicLongArray processedCount = new AtomicLongArray(BUFFER_COUNT); - @SuppressWarnings("rawtypes") - private final AtomicReferenceArray>[] buffers = new AtomicReferenceArray[BUFFER_COUNT]; + @SuppressWarnings({"unchecked", "rawtypes"}) + private final AtomicReferenceArray<@Nullable Node>[] buffers = new AtomicReferenceArray[BUFFER_COUNT]; private final EvictionQueue evictionQueue; - @SuppressWarnings("rawtypes") ReadOperations(EvictionQueue evictionQueue) { this.evictionQueue = evictionQueue; for (int i = 0; i < BUFFER_COUNT; i++) { - this.buffers[i] = new AtomicReferenceArray(BUFFER_SIZE); + this.buffers[i] = new AtomicReferenceArray<>(BUFFER_SIZE); } } @@ -427,7 +425,7 @@ void drain() { void clear() { for (int i = 0; i < BUFFER_COUNT; i++) { - AtomicReferenceArray> buffer = this.buffers[i]; + AtomicReferenceArray<@Nullable Node> buffer = this.buffers[i]; for (int j = 0; j < BUFFER_SIZE; j++) { buffer.lazySet(j, null); } @@ -438,7 +436,7 @@ private void drainReadBuffer(int bufferIndex) { final long writeCount = this.recordedCount.get(bufferIndex); for (int i = 0; i < MAX_DRAIN_COUNT; i++) { final int index = (int) (this.readCount[bufferIndex] & BUFFER_INDEX_MASK); - final AtomicReferenceArray> buffer = this.buffers[bufferIndex]; + final AtomicReferenceArray<@Nullable Node> buffer = this.buffers[bufferIndex]; final Node node = buffer.get(index); if (node == null) { break;