mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-07 22:09:38 +07:00
[java-inspection] NullableStuffInspectionBase: better determine annotation name
GitOrigin-RevId: 1c00dc9d26ce2e8ebf78379fefbd6b3a9e764007
This commit is contained in:
committed by
intellij-monorepo-bot
parent
717ff7f689
commit
f5463b7662
@@ -0,0 +1,28 @@
|
||||
import org.jetbrains.annotations.NotNullByDefault;
|
||||
|
||||
@NotNullByDefault
|
||||
class FromDemo {
|
||||
<T extends Number> T get(T <warning descr="Parameter annotated @NotNullByDefault should not receive 'null' as an argument">b</warning>) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void test() {
|
||||
Object o = new FromDemo().get(null);
|
||||
if (o == null) {
|
||||
|
||||
System.out.println("1");
|
||||
}
|
||||
}
|
||||
|
||||
<T extends Number> T get2(T <warning descr="Parameter annotated @NotNullByDefault should not receive 'null' as an argument">o</warning>) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void test2() {
|
||||
Object o = new FromDemo().get2(null);
|
||||
if (o == null) {
|
||||
|
||||
System.out.println("1");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -421,4 +421,9 @@ public class NullableStuffInspectionTest extends LightJavaCodeInsightFixtureTest
|
||||
DataFlowInspectionTestCase.setupTypeUseAnnotations("org.jspecify.annotations", myFixture);
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testParameterUnderDefaultNotNull() {
|
||||
DataFlowInspectionTestCase.addJetBrainsNotNullByDefault(myFixture);
|
||||
doTest();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user