mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-09 20:42:52 +07:00
IDEA-170214 Properly handle Bean Validation inheritance in @NotNull/@Nullable problems inspection
This commit is contained in:
@@ -0,0 +1,13 @@
|
||||
import javax.annotation.constraints.*;
|
||||
|
||||
interface Intf {
|
||||
@NotNull Object foo(@NotNull Object p);
|
||||
}
|
||||
|
||||
class Impl implements Intf {
|
||||
@Override
|
||||
public Object foo(Object p) {
|
||||
return p;
|
||||
}
|
||||
|
||||
}
|
||||
+8
-1
@@ -115,7 +115,7 @@ public class NullableStuffInspectionTest extends LightCodeInsightFixtureTestCase
|
||||
DataFlowInspectionTest.addJavaxDefaultNullabilityAnnotations(myFixture);
|
||||
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; import javax.annotation.*; public interface NullableFunction { void fun(@Nullable Object o); }");
|
||||
myFixture.addClass("package foo; public interface AnyFunction { void fun(Object o); }");
|
||||
|
||||
doTest();
|
||||
@@ -195,4 +195,11 @@ public class NullableStuffInspectionTest extends LightCodeInsightFixtureTestCase
|
||||
myFixture.checkHighlighting(true, false, true);
|
||||
}
|
||||
|
||||
public void testBeanValidationNotNull() {
|
||||
myFixture.addClass("package javax.annotation.constraints; public @interface NotNull{}");
|
||||
DataFlowInspection8Test.setCustomAnnotations(getProject(), getTestRootDisposable(), "javax.annotation.constraints.NotNull", "javax.annotation.constraints.Nullable");
|
||||
myInspection.REPORT_ANNOTATION_NOT_PROPAGATED_TO_OVERRIDERS = true;
|
||||
doTest();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user