From ed49f86dfb2df4f3e5d6d8ba3b64fea0545ff33b Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sat, 4 Nov 2023 14:38:30 +0100 Subject: [PATCH] Remove obsolete code in ConcurrentReferenceHashMapTests --- .../util/ConcurrentReferenceHashMapTests.java | 20 ------------------- 1 file changed, 20 deletions(-) diff --git a/spring-core/src/test/java/org/springframework/util/ConcurrentReferenceHashMapTests.java b/spring-core/src/test/java/org/springframework/util/ConcurrentReferenceHashMapTests.java index bc4c341495..fad1fb3361 100644 --- a/spring-core/src/test/java/org/springframework/util/ConcurrentReferenceHashMapTests.java +++ b/spring-core/src/test/java/org/springframework/util/ConcurrentReferenceHashMapTests.java @@ -509,11 +509,6 @@ class ConcurrentReferenceHashMapTests { map.createReferenceManager().createReference(null, 1234, null); } - private interface ValueFactory { - - V newValue(int k); - } - private static class TestWeakConcurrentCache extends ConcurrentReferenceHashMap { @@ -521,16 +516,10 @@ class ConcurrentReferenceHashMapTests { private final LinkedList> queue = new LinkedList<>(); - private boolean disableTestHooks; - public TestWeakConcurrentCache() { super(); } - public void setDisableTestHooks(boolean disableTestHooks) { - this.disableTestHooks = disableTestHooks; - } - public TestWeakConcurrentCache(int initialCapacity, float loadFactor, int concurrencyLevel) { super(initialCapacity, loadFactor, concurrencyLevel); } @@ -541,9 +530,6 @@ class ConcurrentReferenceHashMapTests { @Override protected int getHash(@Nullable Object o) { - if (this.disableTestHooks) { - return super.getHash(o); - } // For testing we want more control of the hash this.supplementalHash = super.getHash(o); return (o != null ? o.hashCode() : 0); @@ -558,16 +544,10 @@ class ConcurrentReferenceHashMapTests { return new ReferenceManager() { @Override public Reference createReference(Entry entry, int hash, @Nullable Reference next) { - if (TestWeakConcurrentCache.this.disableTestHooks) { - return super.createReference(entry, hash, next); - } return new MockReference<>(entry, hash, next, TestWeakConcurrentCache.this.queue); } @Override public Reference pollForPurge() { - if (TestWeakConcurrentCache.this.disableTestHooks) { - return super.pollForPurge(); - } return TestWeakConcurrentCache.this.queue.isEmpty() ? null : TestWeakConcurrentCache.this.queue.removeFirst(); } };