mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-09 20:42:52 +07:00
IDEA-65566 Allow 'NotNull' as the default element behavior for a given class or package
This commit is contained in:
+25
@@ -0,0 +1,25 @@
|
||||
import foo.*;
|
||||
|
||||
class Some {
|
||||
void foo() {
|
||||
NotNullClass.foo(<warning descr="Passing 'null' argument to parameter annotated as @NotNull">null</warning>);
|
||||
NotNullClass.foo("a");
|
||||
|
||||
NullableClass.foo(null);
|
||||
NullableClass.foo("a");
|
||||
|
||||
AnotherPackageNotNull.foo(<warning descr="Passing 'null' argument to parameter annotated as @NotNull">null</warning>);
|
||||
AnotherPackageNotNull.foo("a");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@javax.annotation.ParametersAreNonnullByDefault
|
||||
class NotNullClass {
|
||||
static void foo(String s) {}
|
||||
|
||||
}
|
||||
@javax.annotation.ParametersAreNullableByDefault
|
||||
class NullableClass {
|
||||
static void foo(String s) {}
|
||||
}
|
||||
@@ -303,6 +303,16 @@ public class DataFlowInspectionTest extends LightCodeInsightFixtureTestCase {
|
||||
|
||||
public void testNotEqualsTypo() { doTest(); }
|
||||
public void testAndEquals() { doTest(); }
|
||||
|
||||
public void testParametersAreNonnullByDefault() {
|
||||
myFixture.addClass("package javax.annotation; public @interface ParametersAreNonnullByDefault {}");
|
||||
myFixture.addClass("package javax.annotation; public @interface ParametersAreNullableByDefault {}");
|
||||
|
||||
myFixture.addClass("package foo; public class AnotherPackageNotNull { public static void foo(String s) {}}");
|
||||
myFixture.addFileToProject("foo/package-info.java", "@javax.annotation.ParametersAreNonnullByDefault package foo;");
|
||||
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void _testNullCheckBeforeInstanceof() { doTest(); } // http://youtrack.jetbrains.com/issue/IDEA-113220
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user