private Expression findStaticFieldOrPropAccessorImportFromModule(String name) {
    ModuleNode module = currentClass.getModule();
    if (module == null) return null;
    Map<String, ImportNode> importNodes = module.getStaticImports();
    Expression expression;
    String accessorName = getAccessorName(name);
    // look for one of these:
    //   import static MyClass.setProp [as setOtherProp]
    //   import static MyClass.getProp [as getOtherProp]
    // when resolving prop reference
    if (importNodes.containsKey(accessorName)) {
      ImportNode importNode = importNodes.get(accessorName);
      expression =
          findStaticPropertyAccessorByFullName(importNode.getType(), importNode.getFieldName());
      if (expression != null) return expression;
      expression =
          findStaticPropertyAccessor(
              importNode.getType(), getPropNameForAccessor(importNode.getFieldName()));
      if (expression != null) return expression;
    }
    if (accessorName.startsWith("get")) {
      accessorName = "is" + accessorName.substring(3);
      if (importNodes.containsKey(accessorName)) {
        ImportNode importNode = importNodes.get(accessorName);
        expression =
            findStaticPropertyAccessorByFullName(importNode.getType(), importNode.getFieldName());
        if (expression != null) return expression;
        expression =
            findStaticPropertyAccessor(
                importNode.getType(), getPropNameForAccessor(importNode.getFieldName()));
        if (expression != null) return expression;
      }
    }

    // look for one of these:
    //   import static MyClass.prop [as otherProp]
    // when resolving prop or field reference
    if (importNodes.containsKey(name)) {
      ImportNode importNode = importNodes.get(name);
      expression = findStaticPropertyAccessor(importNode.getType(), importNode.getFieldName());
      if (expression != null) return expression;
      expression = findStaticField(importNode.getType(), importNode.getFieldName());
      if (expression != null) return expression;
    }
    // look for one of these:
    //   import static MyClass.*
    // when resolving prop or field reference
    for (ImportNode importNode : module.getStaticStarImports().values()) {
      ClassNode node = importNode.getType();
      expression = findStaticPropertyAccessor(node, name);
      if (expression != null) return expression;
      expression = findStaticField(node, name);
      if (expression != null) return expression;
    }
    return null;
  }
  public List<ImportNode> getAllImportNodes() {
    if (sortedImports == null) {
      sortedImports = new ArrayList<ImportNode>();

      sortedImports.addAll(module.getImports());
      sortedImports.addAll(module.getStarImports());
      sortedImports.addAll(module.getStaticImports().values());
      sortedImports.addAll(module.getStaticStarImports().values());

      Collections.sort(sortedImports, new ImportNodeComparator());
      sortedImports = Collections.unmodifiableList(sortedImports);
    }
    return sortedImports;
  }
 private Expression transformMapEntryExpression(
     MapEntryExpression me, ClassNode constructorCallType) {
   Expression key = me.getKeyExpression();
   Expression value = me.getValueExpression();
   ModuleNode module = currentClass.getModule();
   if (module != null && key instanceof ConstantExpression) {
     Map<String, ImportNode> importNodes = module.getStaticImports();
     if (importNodes.containsKey(key.getText())) {
       ImportNode importNode = importNodes.get(key.getText());
       if (importNode.getType().equals(constructorCallType)) {
         String newKey = importNode.getFieldName();
         return new MapEntryExpression(
             new ConstantExpression(newKey), value.transformExpression(this));
       }
     }
   }
   return me;
 }
 public void visitImports(ModuleNode node) {
   if (node != null) {
     for (ImportNode importNode : node.getImports()) {
       visitAnnotations(importNode);
       importNode.visit(this);
     }
     for (ImportNode importStarNode : node.getStarImports()) {
       visitAnnotations(importStarNode);
       importStarNode.visit(this);
     }
     for (ImportNode importStaticNode : node.getStaticImports().values()) {
       visitAnnotations(importStaticNode);
       importStaticNode.visit(this);
     }
     for (ImportNode importStaticStarNode : node.getStaticStarImports().values()) {
       visitAnnotations(importStaticStarNode);
       importStaticStarNode.visit(this);
     }
   }
 }
 private Expression findStaticMethodImportFromModule(Expression method, Expression args) {
   ModuleNode module = currentClass.getModule();
   if (module == null || !(method instanceof ConstantExpression)) return null;
   Map<String, ImportNode> importNodes = module.getStaticImports();
   ConstantExpression ce = (ConstantExpression) method;
   Expression expression;
   Object value = ce.getValue();
   // skip non-Strings, e.g. Integer
   if (!(value instanceof String)) return null;
   final String name = (String) value;
   // look for one of these:
   //   import static SomeClass.method [as otherName]
   // when resolving methodCall() or getProp() or setProp()
   if (importNodes.containsKey(name)) {
     ImportNode importNode = importNodes.get(name);
     expression = findStaticMethod(importNode.getType(), importNode.getFieldName(), args);
     if (expression != null) return expression;
     expression =
         findStaticPropertyAccessorGivenArgs(
             importNode.getType(), getPropNameForAccessor(importNode.getFieldName()), args);
     if (expression != null) {
       return new StaticMethodCallExpression(
           importNode.getType(), importNode.getFieldName(), args);
     }
   }
   // look for one of these:
   //   import static SomeClass.someProp [as otherName]
   // when resolving getProp() or setProp()
   if (validPropName(name)) {
     String propName = getPropNameForAccessor(name);
     if (importNodes.containsKey(propName)) {
       ImportNode importNode = importNodes.get(propName);
       expression =
           findStaticMethod(
               importNode.getType(), prefix(name) + capitalize(importNode.getFieldName()), args);
       if (expression != null) return expression;
       expression =
           findStaticPropertyAccessorGivenArgs(
               importNode.getType(), importNode.getFieldName(), args);
       if (expression != null) {
         return new StaticMethodCallExpression(
             importNode.getType(), prefix(name) + capitalize(importNode.getFieldName()), args);
       }
     }
   }
   Map<String, ImportNode> starImports = module.getStaticStarImports();
   ClassNode starImportType;
   if (currentClass.isEnum() && starImports.containsKey(currentClass.getName())) {
     ImportNode importNode = starImports.get(currentClass.getName());
     starImportType = importNode == null ? null : importNode.getType();
     expression = findStaticMethod(starImportType, name, args);
     if (expression != null) return expression;
   } else {
     for (ImportNode importNode : starImports.values()) {
       starImportType = importNode == null ? null : importNode.getType();
       expression = findStaticMethod(starImportType, name, args);
       if (expression != null) return expression;
       expression =
           findStaticPropertyAccessorGivenArgs(starImportType, getPropNameForAccessor(name), args);
       if (expression != null) {
         return new StaticMethodCallExpression(starImportType, name, args);
       }
     }
   }
   return null;
 }
 // not available in 1.6 stream
 public static Map<String, ImportNode> getStaticImports(ModuleNode node) {
   return node.getStaticImports();
 }
  private Expression findStaticFieldOrPropAccessorImportFromModule(String name) {
    ModuleNode module = currentClass.getModule();
    if (module == null) return null;
    Map<String, ImportNode> importNodes = module.getStaticImports();
    Expression expression = null;
    String accessorName = getAccessorName(name);
    // look for one of these:
    //   import static MyClass.setProp [as setOtherProp]
    //   import static MyClass.getProp [as getOtherProp]
    // when resolving prop reference
    if (importNodes.containsKey(accessorName)) {
      ImportNode importNode = importNodes.get(accessorName);
      expression =
          findStaticPropertyAccessorByFullName(importNode.getType(), importNode.getFieldName());
      if (expression != null) return expression;
      expression =
          findStaticPropertyAccessor(
              importNode.getType(), getPropNameForAccessor(importNode.getFieldName()));
      if (expression != null) return expression;
    }
    if (accessorName.startsWith("get")) {
      accessorName = "is" + accessorName.substring(3);
      if (importNodes.containsKey(accessorName)) {
        ImportNode importNode = importNodes.get(accessorName);
        expression =
            findStaticPropertyAccessorByFullName(importNode.getType(), importNode.getFieldName());
        if (expression != null) return expression;
        expression =
            findStaticPropertyAccessor(
                importNode.getType(), getPropNameForAccessor(importNode.getFieldName()));
        if (expression != null) return expression;
      }
    }

    // look for one of these:
    //   import static MyClass.prop [as otherProp]
    // when resolving prop or field reference
    if (importNodes.containsKey(name)) {
      ImportNode importNode = importNodes.get(name);
      // GRECLIPSE add
      try {
        if (!isReconcile) {
          // GRECLIPSE end
          expression = findStaticPropertyAccessor(importNode.getType(), importNode.getFieldName());
          if (expression != null) return expression;
          // GRECLIPSE add
        }
        // end
        expression = findStaticField(importNode.getType(), importNode.getFieldName());
        if (expression != null) return expression;
        // GRECLIPSE add
      } finally {
        // store the identifier to facilitate organizing static imports
        if (expression != null) expression.setNodeMetaData("static.import.alias", name);
      }
      // GRECLIPSE end
    }
    // look for one of these:
    //   import static MyClass.*
    // when resolving prop or field reference
    for (ImportNode importNode : module.getStaticStarImports().values()) {
      ClassNode node = importNode.getType();
      expression = findStaticPropertyAccessor(node, name);
      if (expression != null) return expression;
      expression = findStaticField(node, name);
      if (expression != null) return expression;
    }
    return null;
  }