public void addSubClass(Clazz clazz) {
    if (subClasses == null) {
      subClasses = new Clazz[1];
    } else {
      // Copy the old elements into new larger array.
      Clazz[] temp = new Clazz[subClasses.length + 1];
      System.arraycopy(subClasses, 0, temp, 0, subClasses.length);
      subClasses = temp;
    }

    subClasses[subClasses.length - 1] = clazz;
  }
Esempio n. 2
0
  /** The main method for ProGuard. */
  public static void main(String[] args) {
    if (args.length == 0) {
      System.out.println(VERSION);
      System.out.println("Usage: java proguard.ProGuard [options ...]");
      System.exit(1);
    }

    // Create the default options.
    Configuration configuration = new Configuration();

    try {
      // Parse the options specified in the command line arguments.
      ConfigurationParser parser = new ConfigurationParser(args);

      try {
        parser.parse(configuration);
      } finally {
        parser.close();
      }

      // Execute ProGuard with these options.
      new ProGuard(configuration).execute();
    } catch (Exception ex) {
      if (configuration.verbose) {
        // Print a verbose stack trace.
        ex.printStackTrace();
      } else {
        // Print just the stack trace message.
        System.err.println("Error: " + ex.getMessage());
      }

      System.exit(1);
    }

    System.exit(0);
  }