PsiElementVisitor (@NotNull final ProblemsHolder holder, boolean isOnTheFly) { return new JavaElementVisitor() { @Override public void visitLiteralExpression(@NotNull PsiLiteralExpression expression) { if ("replaced".equals(expression.getValue())) return; holder.registerProblem(expression, "Even in injection", new LocalQuickFix() { @Nls(capitalization = Nls.Capitalization.Sentence) @NotNull @Override public String getFamilyName() { return "Fix over injection"; } @Override public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { PsiElement element = descriptor.getPsiElement(); if (element instanceof PsiLiteralExpression) { element.replace(JavaPsiFacade.getElementFactory(project).createExpressionFromText("\"replaced\"", null)); } } }); } }; }