void (@NotNull GrVariable variable) { checkName(variable); PsiElement parent = variable.getParent(); if (parent instanceof GrForInClause) { PsiElement delimiter = ((GrForInClause)parent).getDelimiter(); if (delimiter.getNode().getElementType() == GroovyTokenTypes.mCOLON) { GrTypeElement typeElement = variable.getTypeElementGroovy(); GrModifierList modifierList = variable.getModifierList(); if (modifierList != null && typeElement == null && StringUtil.isEmptyOrSpaces(modifierList.getText())) { myHolder.newAnnotation(HighlightSeverity.ERROR, GroovyBundle .message("java.style.for.each.statement.requires.a.type.declaration")).range(variable.getNameIdentifierGroovy()) .withFix(new ReplaceDelimiterFix()).create(); } } } PsiNamedElement duplicate = ResolveUtil.findDuplicate(variable); if (duplicate instanceof GrVariable && (variable instanceof GrField || ResolveUtil.isScriptField(variable) || !(duplicate instanceof GrField))) { final String key = duplicate instanceof GrField ? "field.already.defined" : "variable.already.defined"; myHolder.newAnnotation(HighlightSeverity.ERROR, GroovyBundle.message(key, variable.getName())).range(variable.getNameIdentifierGroovy()).create(); } PsiType type = variable.getDeclaredType(); if (type instanceof PsiEllipsisType && !isLastParameter(variable)) { TextRange range = getEllipsisRange(variable); if (range == null) { range = getTypeRange(variable); } if (range != null) { myHolder.newAnnotation(HighlightSeverity.ERROR, GroovyBundle.message("ellipsis.type.is.not.allowed.here")).range(range).create(); } } }