// GRECLIPSE: new method: force the phase on
 public void ensureASTTransformVisitorAdded() {
   ASTTransformationVisitor.addPhaseOperations(this);
 }
  public void visit(ASTNode[] nodes, SourceUnit source) {
    sourceUnit = source;
    loader = null;
    initContextClassLoader = false;

    ModuleNode mn = (ModuleNode) nodes[0];

    allowShortGrab = true;
    allowShortGrabExcludes = true;
    allowShortGrabConfig = true;
    allowShortGrapes = true;
    allowShortGrabResolver = true;
    grabAliases = new HashSet<String>();
    grabExcludeAliases = new HashSet<String>();
    grabConfigAliases = new HashSet<String>();
    grapesAliases = new HashSet<String>();
    grabResolverAliases = new HashSet<String>();
    for (ImportNode im : mn.getImports()) {
      String alias = im.getAlias();
      String className = im.getClassName();
      if ((className.endsWith(GRAB_DOT_NAME) && ((alias == null) || (alias.length() == 0)))
          || (GRAB_CLASS_NAME.equals(alias))) {
        allowShortGrab = false;
      } else if (GRAB_CLASS_NAME.equals(className)) {
        grabAliases.add(im.getAlias());
      }
      if ((className.endsWith(GRAPES_DOT_NAME) && ((alias == null) || (alias.length() == 0)))
          || (GRAPES_CLASS_NAME.equals(alias))) {
        allowShortGrapes = false;
      } else if (GRAPES_CLASS_NAME.equals(className)) {
        grapesAliases.add(im.getAlias());
      }
      if ((className.endsWith(GRABRESOLVER_DOT_NAME) && ((alias == null) || (alias.length() == 0)))
          || (GRABRESOLVER_CLASS_NAME.equals(alias))) {
        allowShortGrabResolver = false;
      } else if (GRABRESOLVER_CLASS_NAME.equals(className)) {
        grabResolverAliases.add(im.getAlias());
      }
    }

    List<Map<String, Object>> grabMaps = new ArrayList<Map<String, Object>>();
    List<Map<String, Object>> grabExcludeMaps = new ArrayList<Map<String, Object>>();

    for (ClassNode classNode : sourceUnit.getAST().getClasses()) {
      grabAnnotations = new ArrayList<AnnotationNode>();
      grabExcludeAnnotations = new ArrayList<AnnotationNode>();
      grabConfigAnnotations = new ArrayList<AnnotationNode>();
      grapesAnnotations = new ArrayList<AnnotationNode>();
      grabResolverAnnotations = new ArrayList<AnnotationNode>();

      visitClass(classNode);

      ClassNode grapeClassNode = ClassHelper.make(Grape.class);

      List<Statement> grabResolverInitializers = new ArrayList<Statement>();

      if (!grapesAnnotations.isEmpty()) {
        for (AnnotationNode node : grapesAnnotations) {
          Expression init = node.getMember("initClass");
          Expression value = node.getMember("value");
          if (value instanceof ListExpression) {
            for (Object o : ((ListExpression) value).getExpressions()) {
              if (o instanceof ConstantExpression) {
                extractGrab(init, (ConstantExpression) o);
              }
            }
          } else if (value instanceof ConstantExpression) {
            extractGrab(init, (ConstantExpression) value);
          }
          // don't worry if it's not a ListExpression, or AnnotationConstant, etc.
          // the rest of GroovyC will flag it as a syntax error later, so we don't
          // need to raise the error ourselves
        }
      }

      if (!grabResolverAnnotations.isEmpty()) {
        grabResolverAnnotationLoop:
        for (AnnotationNode node : grabResolverAnnotations) {
          Map<String, Object> grabResolverMap = new HashMap<String, Object>();
          Expression value = node.getMember("value");
          ConstantExpression ce = null;
          if (value != null && value instanceof ConstantExpression) {
            ce = (ConstantExpression) value;
          }
          String sval = null;
          if (ce != null && ce.getValue() instanceof String) {
            sval = (String) ce.getValue();
          }
          if (sval != null && sval.length() > 0) {
            for (String s : GRABRESOLVER_REQUIRED) {
              Expression member = node.getMember(s);
              if (member != null) {
                addError(
                    "The attribute \""
                        + s
                        + "\" conflicts with attribute 'value' in @"
                        + node.getClassNode().getNameWithoutPackage()
                        + " annotations",
                    node);
                continue grabResolverAnnotationLoop;
              }
            }
            grabResolverMap.put("name", sval);
            grabResolverMap.put("root", sval);
          } else {
            for (String s : GRABRESOLVER_REQUIRED) {
              Expression member = node.getMember(s);
              if (member == null) {
                addError(
                    "The missing attribute \""
                        + s
                        + "\" is required in @"
                        + node.getClassNode().getNameWithoutPackage()
                        + " annotations",
                    node);
                continue grabResolverAnnotationLoop;
              } else if (member != null && !(member instanceof ConstantExpression)) {
                addError(
                    "Attribute \""
                        + s
                        + "\" has value "
                        + member.getText()
                        + " but should be an inline constant in @"
                        + node.getClassNode().getNameWithoutPackage()
                        + " annotations",
                    node);
                continue grabResolverAnnotationLoop;
              }
              grabResolverMap.put(s, ((ConstantExpression) member).getValue());
            }
          }
          Grape.addResolver(grabResolverMap);
          addGrabResolverAsStaticInitIfNeeded(
              grapeClassNode, node, grabResolverInitializers, grabResolverMap);
        }
      }

      if (!grabConfigAnnotations.isEmpty()) {
        for (AnnotationNode node : grabConfigAnnotations) {
          checkForClassLoader(node);
          checkForInitContextClassLoader(node);
          checkForAutoDownload(node);
          checkForDisableChecksums(node);
        }
        addInitContextClassLoaderIfNeeded(classNode);
      }

      if (!grabExcludeAnnotations.isEmpty()) {
        grabExcludeAnnotationLoop:
        for (AnnotationNode node : grabExcludeAnnotations) {
          Map<String, Object> grabExcludeMap = new HashMap<String, Object>();
          checkForConvenienceForm(node, true);
          for (String s : GRABEXCLUDE_REQUIRED) {
            Expression member = node.getMember(s);
            if (member == null) {
              addError(
                  "The missing attribute \""
                      + s
                      + "\" is required in @"
                      + node.getClassNode().getNameWithoutPackage()
                      + " annotations",
                  node);
              continue grabExcludeAnnotationLoop;
            } else if (member != null && !(member instanceof ConstantExpression)) {
              addError(
                  "Attribute \""
                      + s
                      + "\" has value "
                      + member.getText()
                      + " but should be an inline constant in @"
                      + node.getClassNode().getNameWithoutPackage()
                      + " annotations",
                  node);
              continue grabExcludeAnnotationLoop;
            }
            grabExcludeMap.put(s, ((ConstantExpression) member).getValue());
          }
          grabExcludeMaps.add(grabExcludeMap);
        }
      }

      if (!grabAnnotations.isEmpty()) {
        grabAnnotationLoop:
        for (AnnotationNode node : grabAnnotations) {
          Map<String, Object> grabMap = new HashMap<String, Object>();
          checkForConvenienceForm(node, false);
          for (String s : GRAB_ALL) {
            Expression member = node.getMember(s);
            if (member == null && !GRAB_OPTIONAL.contains(s)) {
              addError(
                  "The missing attribute \""
                      + s
                      + "\" is required in @"
                      + node.getClassNode().getNameWithoutPackage()
                      + " annotations",
                  node);
              continue grabAnnotationLoop;
            } else if (member != null && !(member instanceof ConstantExpression)) {
              addError(
                  "Attribute \""
                      + s
                      + "\" has value "
                      + member.getText()
                      + " but should be an inline constant in @"
                      + node.getClassNode().getNameWithoutPackage()
                      + " annotations",
                  node);
              continue grabAnnotationLoop;
            }
            if (node.getMember(s) != null) grabMap.put(s, ((ConstantExpression) member).getValue());
          }
          grabMaps.add(grabMap);
          callGrabAsStaticInitIfNeeded(classNode, grapeClassNode, node, grabExcludeMaps);
        }
      }

      if (!grabResolverInitializers.isEmpty()) {
        classNode.addStaticInitializerStatements(grabResolverInitializers, true);
      }
    }

    if (!grabMaps.isEmpty()) {
      Map<String, Object> basicArgs = new HashMap<String, Object>();
      basicArgs.put("classLoader", loader != null ? loader : sourceUnit.getClassLoader());
      if (!grabExcludeMaps.isEmpty()) basicArgs.put("excludes", grabExcludeMaps);
      if (autoDownload != null) basicArgs.put(AUTO_DOWNLOAD_SETTING, autoDownload);
      if (disableChecksums != null) basicArgs.put(DISABLE_CHECKSUMS_SETTING, disableChecksums);

      try {
        Grape.grab(basicArgs, grabMaps.toArray(new Map[grabMaps.size()]));
        // grab may have added more transformations through new URLs added to classpath, so do one
        // more scan
        if (compilationUnit != null) {
          ASTTransformationVisitor.addGlobalTransformsAfterGrab(
              compilationUnit.getASTTransformationsContext());
        }
      } catch (RuntimeException re) {
        // Decided against syntax exception since this is not a syntax error.
        // The down side is we lose line number information for the offending
        // @Grab annotation.
        source.addException(re);
      }
    }
  }
  /**
   * Initializes the CompilationUnit with a CodeSource for controlling security stuff, a class
   * loader for loading classes, and a class loader for loading AST transformations. <b>Note</b> The
   * transform loader must be able to load compiler classes. That means
   * CompilationUnit.class.classLoader must be at last a parent to transformLoader. The other loader
   * has no such constraint.
   *
   * @param transformLoader - the loader for transforms
   * @param loader - loader used to resolve classes against during compilation
   * @param security - security setting for the compilation
   * @param configuration - compilation configuration
   */
  public CompilationUnit(
      CompilerConfiguration configuration,
      CodeSource security,
      GroovyClassLoader loader,
      GroovyClassLoader transformLoader,
      boolean allowTransforms,
      String localTransformsToRunOnReconcile) {
    super(configuration, loader, null);

    this.allowTransforms = allowTransforms;
    this.astTransformationsContext = new ASTTransformationsContext(this, transformLoader);
    this.names = new ArrayList<String>();
    this.queuedSources = new LinkedList<SourceUnit>();
    this.sources = new HashMap<String, SourceUnit>();
    this.summariesBySourceName = new HashMap();
    this.summariesByPublicClassName = new HashMap();
    this.classSourcesByPublicClassName = new HashMap();

    this.ast = new CompileUnit(this.classLoader, security, this.configuration);
    this.generatedClasses = new ArrayList<GroovyClass>();

    this.verifier = new Verifier();
    this.resolveVisitor = new ResolveVisitor(this);
    this.staticImportVisitor = new StaticImportVisitor();
    this.optimizer = new OptimizerVisitor(this);
    // GRECLIPSE start
    if (localTransformsToRunOnReconcile == null) {
      this.localTransformsToRunOnReconcile = Collections.emptyList();
    } else {
      this.localTransformsToRunOnReconcile = new ArrayList<String>();
      try {
        StringTokenizer st = new StringTokenizer(localTransformsToRunOnReconcile, ",");
        while (st.hasMoreElements()) {
          String classname = st.nextToken();
          this.localTransformsToRunOnReconcile.add(classname);
        }
      } catch (Exception e) {
        // presumed security exception
      }
    }
    // GRECLIPSE end

    phaseOperations = new LinkedList[Phases.ALL + 1];
    newPhaseOperations = new LinkedList[Phases.ALL + 1];
    for (int i = 0; i < phaseOperations.length; i++) {
      phaseOperations[i] = new LinkedList();
      newPhaseOperations[i] = new LinkedList();
    }
    addPhaseOperation(
        new SourceUnitOperation() {
          public void call(SourceUnit source) throws CompilationFailedException {
            source.parse();
          }
        },
        Phases.PARSING);
    addPhaseOperation(convert, Phases.CONVERSION);
    addPhaseOperation(
        new PrimaryClassNodeOperation() {
          public void call(SourceUnit source, GeneratorContext context, ClassNode classNode)
              throws CompilationFailedException {
            EnumVisitor ev = new EnumVisitor(CompilationUnit.this, source);
            ev.visitClass(classNode);
          }
        },
        Phases.CONVERSION);
    addPhaseOperation(resolve, Phases.SEMANTIC_ANALYSIS);
    addPhaseOperation(staticImport, Phases.SEMANTIC_ANALYSIS);
    addPhaseOperation(
        new PrimaryClassNodeOperation() {
          @Override
          public void call(SourceUnit source, GeneratorContext context, ClassNode classNode)
              throws CompilationFailedException {
            InnerClassVisitor iv = new InnerClassVisitor(CompilationUnit.this, source);
            iv.visitClass(classNode);
          }
        },
        Phases.SEMANTIC_ANALYSIS);
    addPhaseOperation(compileCompleteCheck, Phases.CANONICALIZATION);
    addPhaseOperation(classgen, Phases.CLASS_GENERATION);
    // GRECLIPSE: start: skip output phase
    // addPhaseOperation(output);

    ASTTransformationVisitor.addPhaseOperations(this);
    addPhaseOperation(
        new PrimaryClassNodeOperation() {
          @Override
          public void call(SourceUnit source, GeneratorContext context, ClassNode classNode)
              throws CompilationFailedException {
            StaticVerifier sv = new StaticVerifier();
            sv.visitClass(classNode, source);
          }
        },
        Phases.SEMANTIC_ANALYSIS);
    addPhaseOperation(
        new PrimaryClassNodeOperation() {
          @Override
          public void call(SourceUnit source, GeneratorContext context, ClassNode classNode)
              throws CompilationFailedException {
            InnerClassCompletionVisitor iv =
                new InnerClassCompletionVisitor(CompilationUnit.this, source);
            iv.visitClass(classNode);
          }
        },
        Phases.CANONICALIZATION);
    addPhaseOperation(
        new PrimaryClassNodeOperation() {
          public void call(SourceUnit source, GeneratorContext context, ClassNode classNode)
              throws CompilationFailedException {
            EnumCompletionVisitor ecv = new EnumCompletionVisitor(CompilationUnit.this, source);
            ecv.visitClass(classNode);
          }
        },
        Phases.CANONICALIZATION);

    // apply configuration customizers if any
    if (configuration != null) {
      final List<CompilationCustomizer> customizers = configuration.getCompilationCustomizers();
      for (CompilationCustomizer customizer : customizers) {
        addPhaseOperation(customizer, customizer.getPhase().getPhaseNumber());
      }
    }
    this.classgenCallback = null;
    this.classNodeResolver = new ClassNodeResolver();
  }
  public void visit(ASTNode[] nodes, SourceUnit source) {
    sourceUnit = source;
    loader = null;
    initContextClassLoader = false;

    ModuleNode mn = (ModuleNode) nodes[0];

    allowShortGrab = true;
    allowShortGrabExcludes = true;
    allowShortGrabConfig = true;
    allowShortGrapes = true;
    allowShortGrabResolver = true;
    grabAliases = new HashSet<String>();
    grabExcludeAliases = new HashSet<String>();
    grabConfigAliases = new HashSet<String>();
    grapesAliases = new HashSet<String>();
    grabResolverAliases = new HashSet<String>();
    for (ImportNode im : mn.getImports()) {
      String alias = im.getAlias();
      String className = im.getClassName();
      if ((className.endsWith(GRAB_DOT_NAME) && ((alias == null) || (alias.length() == 0)))
          || (GRAB_CLASS_NAME.equals(alias))) {
        allowShortGrab = false;
      } else if (GRAB_CLASS_NAME.equals(className)) {
        grabAliases.add(im.getAlias());
      }
      if ((className.endsWith(GRAPES_DOT_NAME) && ((alias == null) || (alias.length() == 0)))
          || (GRAPES_CLASS_NAME.equals(alias))) {
        allowShortGrapes = false;
      } else if (GRAPES_CLASS_NAME.equals(className)) {
        grapesAliases.add(im.getAlias());
      }
      if ((className.endsWith(GRABRESOLVER_DOT_NAME) && ((alias == null) || (alias.length() == 0)))
          || (GRABRESOLVER_CLASS_NAME.equals(alias))) {
        allowShortGrabResolver = false;
      } else if (GRABRESOLVER_CLASS_NAME.equals(className)) {
        grabResolverAliases.add(im.getAlias());
      }
    }

    List<Map<String, Object>> grabMaps = new ArrayList<Map<String, Object>>();
    List<Map<String, Object>> grabMapsInit = new ArrayList<Map<String, Object>>();
    List<Map<String, Object>> grabExcludeMaps = new ArrayList<Map<String, Object>>();

    for (ClassNode classNode : sourceUnit.getAST().getClasses()) {
      grabAnnotations = new ArrayList<AnnotationNode>();
      grabExcludeAnnotations = new ArrayList<AnnotationNode>();
      grabConfigAnnotations = new ArrayList<AnnotationNode>();
      grapesAnnotations = new ArrayList<AnnotationNode>();
      grabResolverAnnotations = new ArrayList<AnnotationNode>();

      visitClass(classNode);

      ClassNode grapeClassNode = ClassHelper.make(Grape.class);

      List<Statement> grabResolverInitializers = new ArrayList<Statement>();

      if (!grapesAnnotations.isEmpty()) {
        for (AnnotationNode node : grapesAnnotations) {
          Expression init = node.getMember("initClass");
          Expression value = node.getMember("value");
          if (value instanceof ListExpression) {
            for (Object o : ((ListExpression) value).getExpressions()) {
              if (o instanceof ConstantExpression) {
                extractGrab(init, (ConstantExpression) o);
              }
            }
          } else if (value instanceof ConstantExpression) {
            extractGrab(init, (ConstantExpression) value);
          }
          // don't worry if it's not a ListExpression, or AnnotationConstant, etc.
          // the rest of GroovyC will flag it as a syntax error later, so we don't
          // need to raise the error ourselves
        }
      }

      if (!grabResolverAnnotations.isEmpty()) {
        grabResolverAnnotationLoop:
        for (AnnotationNode node : grabResolverAnnotations) {
          Map<String, Object> grabResolverMap = new HashMap<String, Object>();
          String sval = getMemberStringValue(node, "value");
          if (sval != null && sval.length() > 0) {
            for (String s : GRABRESOLVER_REQUIRED) {
              String mval = getMemberStringValue(node, s);
              if (mval != null && mval.isEmpty()) mval = null;
              if (mval != null) {
                addError(
                    "The attribute \""
                        + s
                        + "\" conflicts with attribute 'value' in @"
                        + node.getClassNode().getNameWithoutPackage()
                        + " annotations",
                    node);
                continue grabResolverAnnotationLoop;
              }
            }
            grabResolverMap.put("name", sval);
            grabResolverMap.put("root", sval);
          } else {
            for (String s : GRABRESOLVER_REQUIRED) {
              String mval = getMemberStringValue(node, s);
              if (mval != null && mval.isEmpty()) mval = null;
              Expression member = node.getMember(s);
              if (member == null || mval == null) {
                addError(
                    "The missing attribute \""
                        + s
                        + "\" is required in @"
                        + node.getClassNode().getNameWithoutPackage()
                        + " annotations",
                    node);
                continue grabResolverAnnotationLoop;
              } else if (mval == null) {
                addError(
                    "Attribute \""
                        + s
                        + "\" has value "
                        + member.getText()
                        + " but should be an inline constant String in @"
                        + node.getClassNode().getNameWithoutPackage()
                        + " annotations",
                    node);
                continue grabResolverAnnotationLoop;
              }
              grabResolverMap.put(s, mval);
            }
          }

          // If no scheme is specified for the repository root,
          // then turn it into a URI relative to that of the source file.
          String root = (String) grabResolverMap.get("root");
          if (root != null && !root.contains(":")) {
            URI sourceURI = null;
            // Since we use the data: scheme for StringReaderSources (which are fairly common)
            // and those are not hierarchical we can't use them for making an absolute URI.
            if (!(getSourceUnit().getSource() instanceof StringReaderSource)) {
              // Otherwise let's trust the source to know where it is from.
              // And actually InputStreamReaderSource doesn't know what to do and so returns null.
              sourceURI = getSourceUnit().getSource().getURI();
            }
            // If source doesn't know how to get a reference to itself,
            // then let's use the current working directory, since the repo can be relative to that.
            if (sourceURI == null) {
              sourceURI = new File(".").toURI();
            }
            try {
              URI rootURI = sourceURI.resolve(new URI(root));
              grabResolverMap.put("root", rootURI.toString());
            } catch (URISyntaxException e) {
              // We'll be silent here.
              // If the URI scheme is unknown or not hierarchical, then we just can't help them and
              // shouldn't cause any trouble either.
              // addError("Attribute \"root\" has value '" + root + "' which can't be turned into a
              // valid URI relative to it's source '" + getSourceUnit().getName() + "' @" +
              // node.getClassNode().getNameWithoutPackage() + " annotations", node);
            }
          }

          Grape.addResolver(grabResolverMap);
          addGrabResolverAsStaticInitIfNeeded(
              grapeClassNode, node, grabResolverInitializers, grabResolverMap);
        }
      }

      if (!grabConfigAnnotations.isEmpty()) {
        for (AnnotationNode node : grabConfigAnnotations) {
          checkForClassLoader(node);
          checkForInitContextClassLoader(node);
          checkForAutoDownload(node);
          checkForDisableChecksums(node);
        }
        addInitContextClassLoaderIfNeeded(classNode);
      }

      if (!grabExcludeAnnotations.isEmpty()) {
        grabExcludeAnnotationLoop:
        for (AnnotationNode node : grabExcludeAnnotations) {
          Map<String, Object> grabExcludeMap = new HashMap<String, Object>();
          checkForConvenienceForm(node, true);
          for (String s : GRABEXCLUDE_REQUIRED) {
            Expression member = node.getMember(s);
            if (member == null) {
              addError(
                  "The missing attribute \""
                      + s
                      + "\" is required in @"
                      + node.getClassNode().getNameWithoutPackage()
                      + " annotations",
                  node);
              continue grabExcludeAnnotationLoop;
            } else if (member != null && !(member instanceof ConstantExpression)) {
              addError(
                  "Attribute \""
                      + s
                      + "\" has value "
                      + member.getText()
                      + " but should be an inline constant in @"
                      + node.getClassNode().getNameWithoutPackage()
                      + " annotations",
                  node);
              continue grabExcludeAnnotationLoop;
            }
            grabExcludeMap.put(s, ((ConstantExpression) member).getValue());
          }
          grabExcludeMaps.add(grabExcludeMap);
        }
      }

      if (!grabAnnotations.isEmpty()) {
        grabAnnotationLoop:
        for (AnnotationNode node : grabAnnotations) {
          Map<String, Object> grabMap = new HashMap<String, Object>();
          checkForConvenienceForm(node, false);
          for (String s : GRAB_ALL) {
            Expression member = node.getMember(s);
            String mval = getMemberStringValue(node, s);
            if (mval != null && mval.isEmpty()) member = null;
            if (member == null && !GRAB_OPTIONAL.contains(s)) {
              addError(
                  "The missing attribute \""
                      + s
                      + "\" is required in @"
                      + node.getClassNode().getNameWithoutPackage()
                      + " annotations",
                  node);
              continue grabAnnotationLoop;
            } else if (member != null && !(member instanceof ConstantExpression)) {
              addError(
                  "Attribute \""
                      + s
                      + "\" has value "
                      + member.getText()
                      + " but should be an inline constant in @"
                      + node.getClassNode().getNameWithoutPackage()
                      + " annotations",
                  node);
              continue grabAnnotationLoop;
            }
            if (node.getMember(s) != null) {
              grabMap.put(s, ((ConstantExpression) member).getValue());
            }
          }
          grabMaps.add(grabMap);
          if ((node.getMember("initClass") == null)
              || (node.getMember("initClass") == ConstantExpression.TRUE)) {
            grabMapsInit.add(grabMap);
          }
        }
        callGrabAsStaticInitIfNeeded(classNode, grapeClassNode, grabMapsInit, grabExcludeMaps);
      }

      if (!grabResolverInitializers.isEmpty()) {
        classNode.addStaticInitializerStatements(grabResolverInitializers, true);
      }
    }

    if (!grabMaps.isEmpty()) {
      Map<String, Object> basicArgs = new HashMap<String, Object>();
      basicArgs.put("classLoader", loader != null ? loader : sourceUnit.getClassLoader());
      if (!grabExcludeMaps.isEmpty()) basicArgs.put("excludes", grabExcludeMaps);
      if (autoDownload != null) basicArgs.put(AUTO_DOWNLOAD_SETTING, autoDownload);
      if (disableChecksums != null) basicArgs.put(DISABLE_CHECKSUMS_SETTING, disableChecksums);

      try {
        Grape.grab(basicArgs, grabMaps.toArray(new Map[grabMaps.size()]));
        // grab may have added more transformations through new URLs added to classpath, so do one
        // more scan
        if (compilationUnit != null) {
          ASTTransformationVisitor.addGlobalTransformsAfterGrab(
              compilationUnit.getASTTransformationsContext());
        }
      } catch (RuntimeException re) {
        // Decided against syntax exception since this is not a syntax error.
        // The down side is we lose line number information for the offending
        // @Grab annotation.
        source.addException(re);
      }
    }
  }