LocalQuickFix (Object... infos) { final PsiElement elt = (PsiElement)infos[0]; if (!AnnotationUtil.isAnnotatingApplicable(elt)) { return null; } final PsiMethod method = PsiTreeUtil.getParentOfType(elt, PsiMethod.class, false, PsiLambdaExpression.class); if (method == null) return null; final PsiType type = method.getReturnType(); if (TypeUtils.isOptional(type)) { // don't suggest to annotate Optional methods as Nullable return new ReplaceWithEmptyOptionalFix(((PsiClassType)type).rawType().getCanonicalText()); } final NullableNotNullManager manager = NullableNotNullManager.getInstance(elt.getProject()); return new AddAnnotationPsiFix(manager.getDefaultNullable(), method, ArrayUtilRt.toStringArray(manager.getNotNulls())); }