boolean (@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 declaration)) { return false; } else { if (declaration.getVariables().length != 1 || !PsiUtil.isLocalVariable(declaration.getVariables()[0])) { return false; } } if (!GrAnnotationImpl.isAnnotationApplicableTo(annotation, PsiAnnotation.TargetType.LOCAL_VARIABLE)) { GrCodeReferenceElement ref = annotation.getClassReference(); String target = JavaAnalysisBundle.message("annotation.target.LOCAL_VARIABLE"); String description = JavaErrorBundle.message("annotation.not.applicable", ref.getText(), target); holder.newAnnotation(HighlightSeverity.ERROR, description).range(ref).create(); } return true; }