GroovyElementVisitor (@NotNull ProblemsHolder holder, boolean isOnTheFly) { return new GroovyElementVisitor() { @Override public void visitExpression(@NotNull GrExpression expression) { PsiElement expressionParent = expression.getParent(); if (!(expressionParent instanceof GrParameter parameter)) return; if (parameter.getInitializerGroovy() != expression) return; PsiElement parameterParent = parameter.getParent(); if (!(parameterParent instanceof GrParameterList)) return; PsiElement parameterListParent = parameterParent.getParent(); if (!(parameterListParent instanceof GrMethod method)) return; if (PsiUtil.OPERATOR_METHOD_NAMES.contains(method.getName())) return; if (isInitializerUnused(parameter, method)) { holder.registerProblem( expression, GroovyBundle.message("unused.default.parameter.message"), QuickFixFactory.getInstance().createDeleteFix(expression, GroovyBundle.message("unused.default.parameter.fix")) ); } } }; }