void (@NotNull GrControlFlowOwner owner, @NotNull GrVariable variable, @NotNull ProblemsHolder problemsHolder) { if (variable instanceof LightElement) return; if (variable.hasModifierProperty(PsiModifier.FINAL)) return; if (!checkVariableDeclaredInsideScope(owner, variable)) return; if (checkVariableAssignedInsideClosureOrAnonymous(owner, variable)) return; final boolean isParameterTooltip = variable instanceof GrParameter && ( ((GrParameter)variable).getDeclarationScope() instanceof GrMethod || ((GrParameter)variable).getDeclarationScope() instanceof GrClosableBlock ); final String tooltip = GroovyBundle.message( isParameterTooltip ? "parameter.can.be.final.tooltip" : "variable.can.be.final.tooltip", variable.getName() ); problemsHolder.registerProblem( variable.getNameIdentifierGroovy(), tooltip, new GrModifierFix(variable, PsiModifier.FINAL, true, ID_MODIFIER_LIST_PROVIDER) ); }