@Override
  public boolean shouldCreateStub(ASTNode node) {
    PsiElement parent = SharedImplUtil.getParent(node);
    if (parent instanceof GrTypeDefinitionBody) {
      // store fields
      return true;
    }
    if (PsiTreeUtil.getParentOfType(parent, GrTypeDefinition.class) != null) {
      // do not store variable declarations within classes, as they are not scripts
      return false;
    }
    PsiElement psi = node.getPsi();
    if (!(psi instanceof GrVariableDeclaration) || ((GrVariableDeclaration)psi).getModifierList().getRawAnnotations().length == 0) {
      // store only annotated declarations
      return false;
    }
    PsiFile file = psi.getContainingFile();
    return file instanceof GroovyFile && ((GroovyFile)file).isScript();
  }
@Override
  public boolean shouldCreateStub(ASTNode node)