boolean (@NotNull GrVariableDeclaration declaration) { PsiFile containingFile = declaration.getContainingFile(); if (!(containingFile instanceof GroovyFile) || !((GroovyFile)containingFile).isScript()) return false; GrMember member = PsiTreeUtil.getParentOfType(declaration, GrTypeDefinition.class, GrMethod.class); if (member != null) return false; return hasAnnotation(declaration.getModifierList(), GroovyCommonClassNames.GROOVY_TRANSFORM_FIELD); }