GrVariableDeclaration (GroovyFile file) { if (!PsiSearchHelper.getInstance(file.getProject()).hasIdentifierInFile(file, "BaseScript")) { return null; } for (GrVariableDeclaration declaration : file.getScriptDeclarations(false)) { if (declaration.getModifierList().hasAnnotation(GROOVY_TRANSFORM_BASE_SCRIPT)) { return declaration; } } return null; }