ModCommand (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { final PsiElement psiElement = descriptor.getPsiElement(); PsiMethod method = PsiTreeUtil.getParentOfType(psiElement, PsiMethod.class); if (method == null) return ModCommand.nop(); final List<PsiMethod> toAnnotate = new ArrayList<>(); if (myAnnotateSelf) { toAnnotate.add(method); } if (myAnnotateOverriddenMethods) { for (PsiMethod inheritor : OverridingMethodsSearch.search(method)) { if (AnnotationUtil.isAnnotatingApplicable(inheritor, myAnnotation) && !AnnotationUtil.isAnnotated(inheritor, myAnnotation, CHECK_EXTERNAL | CHECK_TYPE)) { toAnnotate.add(inheritor); } } } return ModCommand.psiUpdate(ActionContext.from(descriptor), updater -> { for (PsiMethod psiMethod : ContainerUtil.map(toAnnotate, updater::getWritable)) { annotateMethod(psiMethod); } }); }