@Override public boolean checkApplicability( @NotNull AnnotationHolder holder, @NotNull GrAnnotation annotation) { final String qname = annotation.getQualifiedName(); if (!GroovyCommonClassNames.GROOVY_TRANSFORM_FIELD.equals(qname)) return false; checkScriptField(holder, annotation); PsiElement annoParent = annotation.getParent(); PsiElement ownerToUse = annoParent instanceof PsiModifierList ? annoParent.getParent() : annoParent; if (!(ownerToUse instanceof GrVariableDeclaration) || !PsiUtil.isLocalVariable(((GrVariableDeclaration) ownerToUse).getVariables()[0])) { return false; } if (!GrAnnotationImpl.isAnnotationApplicableTo( annotation, PsiAnnotation.TargetType.LOCAL_VARIABLE)) { GrCodeReferenceElement ref = annotation.getClassReference(); String target = JavaErrorMessages.message("annotation.target.LOCAL_VARIABLE"); String description = JavaErrorMessages.message("annotation.not.applicable", ref.getText(), target); holder.createErrorAnnotation(ref, description); } return true; }