void (@NotNull PsiField field) { NullableNotNullManager manager = NullableNotNullManager.getInstance(holder.getProject()); NullabilityAnnotationInfo info = manager.findEffectiveNullabilityInfo(field); if (info == null || info.getNullability() != Nullability.NOT_NULL || HighlightControlFlowUtil.isFieldInitializedAfterObjectConstruction(field)) { return; } boolean implicitWrite = (IGNORE_IMPLICITLY_WRITTEN_FIELDS || isOnTheFly) && UnusedSymbolUtil.isImplicitWrite(field); if (IGNORE_IMPLICITLY_WRITTEN_FIELDS && implicitWrite) return; boolean writtenInSetup = (IGNORE_FIELDS_WRITTEN_IN_SETUP || isOnTheFly) && isWrittenInSetup(field); if (IGNORE_FIELDS_WRITTEN_IN_SETUP && writtenInSetup) return; boolean byDefault = info.isContainer(); PsiAnnotation annotation = info.getAnnotation(); PsiJavaCodeReferenceElement name = annotation.getNameReferenceElement(); boolean ownAnnotation = annotation.isPhysical() && !byDefault; PsiElement anchor = ownAnnotation ? annotation : field.getNameIdentifier(); String message = JavaBundle.message("inspection.notnull.field.not.initialized.message", byDefault && name != null ? "@" + name.getReferenceName() : "Not-null"); List<LocalQuickFix> fixes = new ArrayList<>(); if (implicitWrite) { fixes.add(LocalQuickFix.from(new UpdateInspectionOptionFix( NotNullFieldNotInitializedInspection.this, IGNORE_IMPLICITLY_WRITTEN_FIELDS_NAME, JavaBundle.message("inspection.notnull.field.not.initialized.option.implicit"), true))); } if (writtenInSetup) { fixes.add(LocalQuickFix.from(new UpdateInspectionOptionFix( NotNullFieldNotInitializedInspection.this, IGNORE_FIELDS_WRITTEN_IN_SETUP_NAME, JavaBundle.message("inspection.notnull.field.not.initialized.option.setup"), true))); } if (ownAnnotation) { fixes.add(QuickFixFactory.getInstance().createDeleteFix(annotation, JavaBundle.message("quickfix.text.remove.not.null.annotation"))); } if (isOnTheFly) { fixes.add(LocalQuickFix.from(new InitializeFinalFieldInConstructorFix(field))); fixes.add(LocalQuickFix.from(new AddVariableInitializerFix(field))); } reportProblem(holder, anchor, message, fixes); }