BaseInspectionVisitor () { return new BaseInspectionVisitor() { @Override public void visitReferenceExpression(@NotNull GrReferenceExpression referenceExpression) { super.visitReferenceExpression(referenceExpression); if (!PsiUtil.isLValue(referenceExpression)) return; final PsiElement resolved = referenceExpression.resolve(); if (!PsiUtil.isLocalVariable(resolved)) return; final PsiType checked = GrReassignedLocalVarsChecker.getReassignedVarType(referenceExpression, false); if (checked == null) return; final GrControlFlowOwner varFlowOwner = ControlFlowUtils.findControlFlowOwner(resolved); final GrControlFlowOwner refFlorOwner = ControlFlowUtils.findControlFlowOwner(referenceExpression); if (isOtherScopeAndType(referenceExpression, checked, varFlowOwner, refFlorOwner)) { String flowDescription = getFlowDescription(refFlorOwner); final String message = GroovyBundle.message("local.var.0.is.reassigned", ((GrNamedElement)resolved).getName(), flowDescription); registerError(referenceExpression, message, LocalQuickFix.EMPTY_ARRAY, ProblemHighlightType.GENERIC_ERROR_OR_WARNING); } } }; }