Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Intellij Community
Commits
70e7f33c
Commit
70e7f33c
authored
7 years ago
by
Alexander Kass
Browse files
Options
Download
Email Patches
Plain Diff
Fix null wrapping in CFM
parent
2444a750
Branches unavailable
Tags unavailable
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
platform/platform-tests/testSrc/com/intellij/util/containers/MapInvariantsTestSuite.java
+4
-3
.../com/intellij/util/containers/MapInvariantsTestSuite.java
platform/util/src/com/intellij/util/containers/ConcurrentFactoryMap.java
+5
-8
...rc/com/intellij/util/containers/ConcurrentFactoryMap.java
with
9 additions
and
11 deletions
+9
-11
platform/platform-tests/testSrc/com/intellij/util/containers/MapInvariantsTestSuite.java
+
4
-
3
View file @
70e7f33c
...
...
@@ -43,9 +43,10 @@ public class MapInvariantsTestSuite {
Assert
.
assertEquals
(
1
,
map
.
size
());
Assert
.
assertEquals
(
"Removed val differs"
,
val
,
map
.
remove
(
null
));
Assert
.
assertEquals
(
0
,
map
.
size
());
map
.
put
(
null
,
val
);
Assert
.
assertTrue
(
"Removed val differs"
,
map
.
remove
(
null
,
val
));
Assert
.
assertEquals
(
0
,
map
.
size
());
//todo: ConcurrentMap: strange nullability of remove(K, V), replace(K, V), replace(K, V, V)
//map.put(null, val);
//Assert.assertTrue("Removed val differs", map.remove(null, val));
//Assert.assertEquals(0, map.size());
}
@Test
...
...
This diff is collapsed.
Click to expand it.
platform/util/src/com/intellij/util/containers/ConcurrentFactoryMap.java
+
5
-
8
View file @
70e7f33c
...
...
@@ -24,11 +24,8 @@ import com.intellij.util.Producer;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.Nullable
;
import
java.util.AbstractMap
;
import
java.util.Collection
;
import
java.util.*
;
import
java.util.HashSet
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.concurrent.ConcurrentMap
;
/**
...
...
@@ -99,7 +96,7 @@ public abstract class ConcurrentFactoryMap<K,V> implements ConcurrentMap<K,V> {
@Override
public
V
remove
(
Object
key
)
{
V
v
=
myMap
.
remove
(
key
);
V
v
=
myMap
.
remove
(
notNull
(
key
)
)
;
return
nullize
(
v
);
}
...
...
@@ -140,7 +137,7 @@ public abstract class ConcurrentFactoryMap<K,V> implements ConcurrentMap<K,V> {
@Override
public
boolean
containsValue
(
final
Object
value
)
{
return
myMap
.
containsValue
(
value
);
return
myMap
.
containsValue
(
notNull
(
value
)
)
;
}
@Override
...
...
@@ -179,12 +176,12 @@ public abstract class ConcurrentFactoryMap<K,V> implements ConcurrentMap<K,V> {
@Override
public
V
putIfAbsent
(
@NotNull
K
key
,
V
value
)
{
return
myMap
.
putIfAbsent
(
key
,
value
);
return
myMap
.
putIfAbsent
(
key
,
ConcurrentFactoryMap
.<
V
>
notNull
(
value
)
)
;
}
@Override
public
boolean
remove
(
@NotNull
Object
key
,
Object
value
)
{
return
myMap
.
remove
(
key
,
value
);
return
myMap
.
remove
(
key
,
notNull
(
value
)
)
;
}
@Override
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help