void (PsiField field, Annotated annotated, NullableNotNullManager manager, String anno, List<String> annoToRemove, @NotNull ProblemsHolder holder) { List<PsiExpression> initializers = DfaPsiUtil.findAllConstructorInitializers(field); if (initializers.isEmpty()) return; List<PsiParameter> notNullParams = new ArrayList<>(); boolean isFinal = field.hasModifierProperty(PsiModifier.FINAL); for (PsiExpression rhs : initializers) { if (rhs instanceof PsiReferenceExpression) { PsiElement target = ((PsiReferenceExpression)rhs).resolve(); if (isConstructorParameter(target) && target.isPhysical()) { PsiParameter parameter = (PsiParameter)target; if (REPORT_NOT_ANNOTATED_GETTER && !hasNullability(manager, parameter) && !TypeConversionUtil.isPrimitiveAndNotNull(parameter.getType())) { final PsiIdentifier nameIdentifier = parameter.getNameIdentifier(); if (nameIdentifier != null && nameIdentifier.isPhysical()) { reportProblem(holder, nameIdentifier, createAddAnnotationFix(anno, annoToRemove, parameter), "inspection.nullable.problems.annotated.field.constructor.parameter.not.annotated", getPresentableAnnoName(field)); continue; } } if (isFinal && annotated.isDeclaredNullable && isNotNullNotInferred(parameter, false, false)) { notNullParams.add(parameter); } } } } if (notNullParams.size() != initializers.size()) { // it's not the case that the field is final and @Nullable and always initialized via @NotNull parameters // so there might be other initializers that could justify it being nullable // so don't highlight field and constructor parameter annotation inconsistency return; } PsiIdentifier nameIdentifier = field.getNameIdentifier(); if (nameIdentifier.isPhysical()) { reportProblem(holder, nameIdentifier, AddAnnotationPsiFix.createAddNotNullFix(field), "0.field.is.always.initialized.not.null", getPresentableAnnoName(field)); } }