IJ-CR-187719 [java-inspection] IDEA-382441 jspecify inspection doesn't highlight assignments

- delete REPORT_CONFLICT_IN_ASSIGNMENTS

GitOrigin-RevId: f654c30fbb08d3a7ec7b5359fa95b4f12ef6d018
This commit is contained in:
Mikhail Pyltsin
2026-01-14 10:22:44 +00:00
committed by intellij-monorepo-bot
parent e63a99fef1
commit 6097eb7fb1
3 changed files with 7 additions and 23 deletions
@@ -87,8 +87,6 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection
public boolean REPORT_NULLS_PASSED_TO_NOT_NULL_PARAMETER = true;
@SuppressWarnings("WeakerAccess") public boolean REPORT_REDUNDANT_NULLABILITY_ANNOTATION_IN_THE_SCOPE_OF_ANNOTATED_CONTAINER = true;
@SuppressWarnings("WeakerAccess") public boolean REPORT_CONFLICT_IN_ASSIGNMENTS = true;
private static final Logger LOG = Logger.getInstance(NullableStuffInspectionBase.class);
@Override
@@ -104,7 +102,6 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection
"REPORT_NULLS_PASSED_TO_NOT_NULL_PARAMETER".equals(name) && "true".equals(value) ||
"REPORT_NOT_NULL_TO_NULLABLE_CONFLICTS_IN_ASSIGNMENTS".equals(name) && "false".equals(value) ||
"REPORT_NOT_ANNOTATED_INSTANTIATION_NOT_NULL_TYPE".equals(name) && "false".equals(value) ||
"REPORT_CONFLICT_IN_ASSIGNMENTS".equals(name) && "true".equals(value) ||
"REPORT_REDUNDANT_NULLABILITY_ANNOTATION_IN_THE_SCOPE_OF_ANNOTATED_CONTAINER".equals(name) && "true".equals(value)) {
node.removeContent(child);
}
@@ -215,7 +212,7 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection
}
PsiExpression initializer = field.getInitializer();
PsiElement identifyingElement = field.getIdentifyingElement();
if (REPORT_CONFLICT_IN_ASSIGNMENTS && initializer != null && identifyingElement != null) {
if (initializer != null && identifyingElement != null) {
checkNestedGenericClasses(identifyingElement, field.getType(), initializer.getType(),
ConflictNestedTypeProblem.ASSIGNMENT_NESTED_TYPE_PROBLEM);
}
@@ -494,15 +491,10 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection
public void visitAssignmentExpression(@NotNull PsiAssignmentExpression expression) {
PsiExpression rExpression = expression.getRExpression();
if (rExpression == null) return;
if (REPORT_CONFLICT_IN_ASSIGNMENTS) {
checkNestedGenericClasses(expression.getOperationSign(),
expression.getLExpression().getType(),
rExpression.getType(),
ConflictNestedTypeProblem.ASSIGNMENT_NESTED_TYPE_PROBLEM);
}
else {
checkCollectionNullityOnAssignment(expression.getOperationSign(), expression.getLExpression().getType(), expression.getRExpression());
}
checkNestedGenericClasses(expression.getOperationSign(),
expression.getLExpression().getType(),
rExpression.getType(),
ConflictNestedTypeProblem.ASSIGNMENT_NESTED_TYPE_PROBLEM);
}
@Override
@@ -511,13 +503,8 @@ public class NullableStuffInspectionBase extends AbstractBaseJavaLocalInspection
if (identifier == null) return;
PsiExpression initializer = variable.getInitializer();
if (initializer == null) return;
if (REPORT_CONFLICT_IN_ASSIGNMENTS) {
checkNestedGenericClasses(identifier, variable.getType(), initializer.getType(),
ConflictNestedTypeProblem.ASSIGNMENT_NESTED_TYPE_PROBLEM);
}
else {
checkCollectionNullityOnAssignment(identifier, variable.getType(), variable.getInitializer());
}
checkNestedGenericClasses(identifier, variable.getType(), initializer.getType(),
ConflictNestedTypeProblem.ASSIGNMENT_NESTED_TYPE_PROBLEM);
}
@Override
@@ -48,8 +48,6 @@ public class NullableStuffInspection extends NullableStuffInspectionBase {
checkbox("REPORT_NOT_ANNOTATED_GETTER", JavaBundle.message("inspection.nullable.problems.not.annotated.getters.for.annotated.fields")),
checkbox("REPORT_NULLS_PASSED_TO_NOT_NULL_PARAMETER", JavaBundle.message("inspection.nullable.problems.notnull.parameters.with.null.literal.option")),
checkbox("REPORT_NULLABILITY_ANNOTATION_ON_LOCALS", JavaBundle.message("inspection.nullable.problems.nullability.on.locals")),
checkbox("REPORT_CONFLICT_IN_ASSIGNMENTS", JavaBundle.message(
"inspection.assignment.conflicts")),
checkbox("REPORT_NOT_NULL_TO_NULLABLE_CONFLICTS_IN_ASSIGNMENTS", JavaBundle.message(
"inspection.nullable.problems.notnull.to.nullable.assignment.conflicts")),
checkbox("REPORT_REDUNDANT_NULLABILITY_ANNOTATION_IN_THE_SCOPE_OF_ANNOTATED_CONTAINER", JavaBundle.message(
@@ -564,7 +564,6 @@ inspection.nullable.problems.not.annotated.getters.for.annotated.fields=Report n
inspection.nullable.problems.notnull.overrides.option=Report @NotNull &parameters overriding non-annotated
inspection.nullable.problems.notnull.parameters.with.null.literal.option=Report @NotNull parameters with null-literal argument usages
inspection.nullable.problems.nullability.on.locals=Report nullability annotations on local variables when they are non-applicable
inspection.assignment.conflicts=Report nullability conflicts for nested types in assignment and variable declarations
inspection.nullable.problems.notnull.to.nullable.assignment.conflicts=Report assignment of a not-null type argument to a nullable type argument
inspection.nullable.problems.redundant.nullability.inside.container=Report redundant nullability annotation in the scope of annotated container
inspection.optional.get.without.is.present.message=<code>{0}.#ref()</code> without ''isPresent()'' check