mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 06:05:01 +07:00
IDEA-187645 NPE warning is not issued when "null -> null" method is called with Nullable argument
This commit is contained in:
@@ -2,6 +2,26 @@ import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
class Test2 {
|
||||
interface Project {}
|
||||
interface Sdk {}
|
||||
interface Version {}
|
||||
|
||||
@NotNull
|
||||
native static Test2 getInstance(Project project);
|
||||
|
||||
@Nullable
|
||||
native Sdk getProjectSdk();
|
||||
|
||||
@Contract("null -> null")
|
||||
native static Version getVersion(@Nullable Sdk sdk);
|
||||
|
||||
static void test(Project project) {
|
||||
Version version = getVersion(getInstance(project).getProjectSdk());
|
||||
System.out.println(version.<warning descr="Method invocation 'hashCode' may produce 'java.lang.NullPointerException'">hashCode</warning>());
|
||||
}
|
||||
}
|
||||
|
||||
class Foo {
|
||||
|
||||
public void main(@NotNull Object nn) {
|
||||
@@ -58,4 +78,4 @@ class Test {
|
||||
String test() {
|
||||
return convert(getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user