mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
[java-inspections] IDEA-376188 follow-up: report top-level annotations as well
GitOrigin-RevId: dbd7c1fd3b59880032f44c9d6ca5838d2763eae0
This commit is contained in:
committed by
intellij-monorepo-bot
parent
216eddbbf8
commit
766e2f9727
+9
-10
@@ -265,16 +265,15 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection
|
||||
if (context != null) {
|
||||
checkRedundantInContainerScope(annotation, manager.findDefaultTypeUseNullability(context), nullability);
|
||||
}
|
||||
if (nullability == Nullability.NOT_NULL && PsiUtil.resolveClassInClassTypeOnly(type) instanceof PsiTypeParameter) {
|
||||
PsiType notAnnotated = type.annotate(TypeAnnotationProvider.EMPTY);
|
||||
TypeNullability notAnnotatedNullability = notAnnotated.getNullability();
|
||||
if (notAnnotatedNullability.nullability() == Nullability.NOT_NULL &&
|
||||
notAnnotatedNullability.source() instanceof NullabilitySource.ExtendsBound) {
|
||||
reportProblem(holder, annotation,
|
||||
new RemoveAnnotationQuickFix(annotation, null),
|
||||
"inspection.nullable.problems.redundant.annotation.inherited.notnull");
|
||||
|
||||
}
|
||||
}
|
||||
if (type != null && nullability == Nullability.NOT_NULL && PsiUtil.resolveClassInClassTypeOnly(type) instanceof PsiTypeParameter) {
|
||||
PsiType notAnnotated = type.annotate(TypeAnnotationProvider.EMPTY);
|
||||
TypeNullability notAnnotatedNullability = notAnnotated.getNullability();
|
||||
if (notAnnotatedNullability.nullability() == Nullability.NOT_NULL &&
|
||||
notAnnotatedNullability.source() instanceof NullabilitySource.ExtendsBound) {
|
||||
reportProblem(holder, annotation,
|
||||
new RemoveAnnotationQuickFix(annotation, null),
|
||||
"inspection.nullable.problems.redundant.annotation.inherited.notnull");
|
||||
}
|
||||
}
|
||||
if (type instanceof PsiPrimitiveType) {
|
||||
|
||||
@@ -5,8 +5,10 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
@NotNullByDefault
|
||||
class Container<T> {
|
||||
|
||||
class Container<T extends CharSequence> {
|
||||
<warning descr="Redundant nullability annotation: type parameter upper bound is already non-null">@NotNull</warning> T getT() {
|
||||
return null;
|
||||
}
|
||||
|
||||
<L extends @Nullable Object> List<@NotNull L> get() {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user