void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { List<PsiParameter> toAnnotate = new ArrayList<>(); PsiParameter parameter = PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), PsiParameter.class, false); if (parameter == null || !processParameterInheritorsUnderProgress(parameter, param -> { if (AddAnnotationPsiFix.isAvailable(param, myAnnotation)) { toAnnotate.add(param); } })) { return; } FileModificationService.getInstance().preparePsiElementsForWrite(toAnnotate); RuntimeException exception = null; NullableNotNullManager manager = NullableNotNullManager.getInstance(project); String[] annotationsToRemove = ArrayUtil.toStringArray(myTargetNullability == Nullability.NOT_NULL ? manager.getNullables() : manager.getNotNulls()); for (PsiParameter psiParam : toAnnotate) { assert psiParam != null : toAnnotate; try { if (AnnotationUtil.isAnnotatingApplicable(psiParam, myAnnotation)) { NullabilityAnnotationInfo info = manager.findEffectiveNullabilityInfo(psiParam); if (info != null && info.getNullability() == myTargetNullability && !info.isInferred()) continue; AddAnnotationPsiFix fix = new AddAnnotationPsiFix(myAnnotation, psiParam, annotationsToRemove); PsiFile containingFile = psiParam.getContainingFile(); if (psiParam.isValid() && fix.isAvailable(project, containingFile, psiParam, psiParam)) { fix.invoke(project, containingFile, psiParam, psiParam); } } } catch (PsiInvalidElementAccessException|IncorrectOperationException e) { exception = e; } if (exception != null) { throw exception; } } }