mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java-annotations] getOrDefault 2nd parameter is marked as nullable
Fixes IDEA-367387 Mismatch between IDEA and JSpecify on HashMap.getDefault(...) nullness GitOrigin-RevId: 6e90dcdac5b61aa91431f96d007261ad448ea522
This commit is contained in:
committed by
intellij-monorepo-bot
parent
90e67979e7
commit
b007ebf865
@@ -0,0 +1,13 @@
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@NullMarked
|
||||
class Main {
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
|
||||
public @Nullable String example() {
|
||||
return map.getOrDefault("key", null);
|
||||
}
|
||||
}
|
||||
@@ -160,4 +160,10 @@ public class DataFlowInspection21Test extends DataFlowInspectionTestCase {
|
||||
setupTypeUseAnnotations("org.jspecify.annotations", myFixture);
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testJSpecifyGetOrDefault() {
|
||||
addJSpecifyNullMarked(myFixture);
|
||||
setupTypeUseAnnotations("org.jspecify.annotations", myFixture);
|
||||
doTest();
|
||||
}
|
||||
}
|
||||
@@ -3216,6 +3216,9 @@
|
||||
<val name="pure" val="true"/>
|
||||
</annotation>
|
||||
</item>
|
||||
<item name='java.util.HashMap V getOrDefault(java.lang.Object, V) 1'>
|
||||
<annotation name='org.jetbrains.annotations.Nullable'/>
|
||||
</item>
|
||||
<item name='java.util.HashSet HashSet()'>
|
||||
<annotation name='org.jetbrains.annotations.Contract'>
|
||||
<val name="pure" val="true"/>
|
||||
|
||||
Reference in New Issue
Block a user