mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 13:20:53 +07:00
removed unnecessary underlyingMapSize()
This commit is contained in:
@@ -15,9 +15,7 @@
|
||||
*/
|
||||
package com.intellij.util.containers;
|
||||
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.testFramework.UsefulTestCase;
|
||||
import com.intellij.util.GCUtil;
|
||||
import gnu.trove.TObjectHashingStrategy;
|
||||
import org.junit.Test;
|
||||
@@ -53,21 +51,7 @@ public class ConcurrentMapsTest {
|
||||
@Test(timeout = TIMEOUT)
|
||||
public void testWeakHashMapWithIdentityStrategy() {
|
||||
WeakHashMap<Object, Object> map = new WeakHashMap<>(10,0.5f,ContainerUtil.identityStrategy());
|
||||
Ref<Object> key = Ref.create(new Object());
|
||||
Ref<Object> value = Ref.create(new Object());
|
||||
map.put(key.get(), value.get());
|
||||
|
||||
assertSame(value.get(), map.get(key.get()));
|
||||
value.set(null);
|
||||
key.set(null);
|
||||
do {
|
||||
GCUtil.tryGcSoftlyReachableObjects();
|
||||
System.gc();
|
||||
}
|
||||
while (!map.processQueue());
|
||||
assertEquals(0, map.underlyingMapSize());
|
||||
UsefulTestCase.assertEmpty(map.keySet());
|
||||
assertTrue(map.isEmpty());
|
||||
checkKeyIsTossedAfterGCPressure(map);
|
||||
}
|
||||
|
||||
@Test(timeout = TIMEOUT)
|
||||
@@ -112,7 +96,7 @@ public class ConcurrentMapsTest {
|
||||
checkKeyIsTossedAfterGCPressure(map);
|
||||
}
|
||||
|
||||
private void checkKeyIsTossedAfterGCPressure(ConcurrentMap<Object, Object> map) {
|
||||
private void checkKeyIsTossedAfterGCPressure(Map<Object, Object> map) {
|
||||
map.put(new Object(), new Object());
|
||||
|
||||
//noinspection SizeReplaceableByIsEmpty
|
||||
|
||||
@@ -25,7 +25,6 @@ package com.intellij.util.containers;
|
||||
import gnu.trove.TObjectHashingStrategy;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
|
||||
import java.lang.ref.ReferenceQueue;
|
||||
import java.util.*;
|
||||
@@ -407,9 +406,4 @@ abstract class ConcurrentRefHashMap<K, V> extends AbstractMap<K, V> implements C
|
||||
public boolean equals(final K o1, final K o2) {
|
||||
return o1.equals(o2);
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
int underlyingMapSize() {
|
||||
return myMap.size();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ package com.intellij.util.containers;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import gnu.trove.TObjectHashingStrategy;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
|
||||
import java.lang.ref.ReferenceQueue;
|
||||
import java.util.ArrayList;
|
||||
@@ -239,9 +238,4 @@ abstract class ConcurrentRefValueHashMap<K, V> implements ConcurrentMap<K, V> {
|
||||
public String toString() {
|
||||
return "map size:" + size() + " [" + StringUtil.join(entrySet(), ",") + "]";
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
int underlyingMapSize() {
|
||||
return myMap.size();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.intellij.util.containers;
|
||||
import gnu.trove.THashMap;
|
||||
import gnu.trove.TObjectHashingStrategy;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.TestOnly;
|
||||
|
||||
import java.lang.ref.ReferenceQueue;
|
||||
import java.util.*;
|
||||
@@ -387,9 +386,4 @@ abstract class RefHashMap<K, V> extends AbstractMap<K, V> implements Map<K, V> {
|
||||
if (entrySet == null) entrySet = new EntrySet();
|
||||
return entrySet;
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
int underlyingMapSize() {
|
||||
return myMap.size();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user