mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 09:34:34 +07:00
parameter nullity annotation should have higher-priority than package-level ones
This commit is contained in:
+12
@@ -0,0 +1,12 @@
|
||||
import foo.*;
|
||||
|
||||
class B {
|
||||
{
|
||||
new NullableFunction() {
|
||||
public void fun(Object o) {}
|
||||
};
|
||||
new AnyFunction() {
|
||||
public void fun(Object <warning descr="Not annotated parameter overrides @NotNull parameter">o</warning>) {}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -37,4 +37,16 @@ public class NullableStuffInspectionTest extends LightCodeInsightFixtureTestCase
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testParametersAreNonnullByDefault() {
|
||||
myFixture.addClass("package javax.annotation; public @interface ParametersAreNonnullByDefault {}");
|
||||
myFixture.addClass("package javax.annotation; public @interface Nullable {}");
|
||||
myFixture.addFileToProject("foo/package-info.java", "@javax.annotation.ParametersAreNonnullByDefault package foo;");
|
||||
|
||||
myFixture.addClass("import javax.annotation.*; package foo; public interface NullableFunction { void fun(@Nullable Object o); }");
|
||||
myFixture.addClass("package foo; public interface AnyFunction { void fun(Object o); }");
|
||||
|
||||
myInspection.REPORT_ANNOTATION_NOT_PROPAGATED_TO_OVERRIDERS = true;
|
||||
doTest();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user