Exemplo n.º 1
0
  /**
   * Compiles a hierarchy, starting at 'type' and return a mapping of the name to the location where
   * the classfile for that type resides.
   */
  private Map<String, File> compileHierarchy(Type type) {
    HashMap<String, File> outputDirs = new HashMap<>();

    File outDir = compileOne(type);
    outputDirs.put(type.getName(), outDir);

    Class superClass = type.getSuperclass();
    if (superClass != null) {
      for (Map.Entry<String, File> each : compileHierarchy(superClass).entrySet()) {
        outputDirs.put(each.getKey(), each.getValue());
      }
    }
    for (Extends ext : type.getSupertypes()) {
      Type iface = ext.getType();
      for (Map.Entry<String, File> each : compileHierarchy(iface).entrySet()) {
        outputDirs.put(each.getKey(), each.getValue());
      }
    }

    return outputDirs;
  }