mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
allow dfa inspection to treat all non-annotated members as nullable (IDEA-129898)
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
class Test {
|
||||
Object o;
|
||||
|
||||
void field() {
|
||||
<warning descr="Method invocation 'o.hashCode()' may produce 'java.lang.NullPointerException'">o.hashCode()</warning>;
|
||||
}
|
||||
|
||||
void callUnknownMethod() {
|
||||
<warning descr="Method invocation 'unknownObject().hashCode()' may produce 'java.lang.NullPointerException'">unknownObject().hashCode()</warning>;
|
||||
}
|
||||
|
||||
void callNotNullMethod() {
|
||||
knownObject().hashCode();
|
||||
}
|
||||
|
||||
native Object unknownObject();
|
||||
|
||||
@NotNull
|
||||
native Object knownObject();
|
||||
}
|
||||
@@ -137,6 +137,13 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase {
|
||||
myFixture.testHighlighting(true, false, true, getTestName(false) + ".java");
|
||||
}
|
||||
|
||||
public void testParanoidMode() {
|
||||
final DataFlowInspection inspection = new DataFlowInspection();
|
||||
inspection.TREAT_UNKNOWN_MEMBERS_AS_NULLABLE = true;
|
||||
myFixture.enableInspections(inspection);
|
||||
myFixture.testHighlighting(true, false, true, getTestName(false) + ".java");
|
||||
}
|
||||
|
||||
public void testReportConstantReferences() {
|
||||
doTestReportConstantReferences();
|
||||
myFixture.launchAction(myFixture.findSingleIntention("Replace with 'null'"));
|
||||
|
||||
Reference in New Issue
Block a user