Пример #1
0
  private GwtTestClassLoader() throws NotFoundException, CannotCompileException {
    super(PatchGwtClassPool.get());

    init();

    ConfigurationLoader configurationLoader = ConfigurationLoader.createInstance(this.getParent());

    for (String s : configurationLoader.getDelegateList()) {
      delegateLoadingOf(s);
    }
    for (String s : configurationLoader.getNotDelegateList()) {
      notDelegateLoadingOf(s);
    }

    translator = new GwtTranslator(configurationLoader.getPatchers());
    addTranslator(PatchGwtClassPool.get(), translator);
  }
Пример #2
0
  private byte[] modifiyClass(byte[] classfile, String name) {

    ClassParser parser = new ClassParser(new ByteArrayInputStream(classfile), "");
    try {
      JavaClass cls = parser.parse();

      for (JavaClassModifier modifier :
          ConfigurationLoader.getInstance().getJavaClassModifierList()) {
        modifier.modify(cls);
      }

      ByteArrayOutputStream out = new ByteArrayOutputStream();
      cls.dump(out);

      return out.toByteArray();
    } catch (Exception e) {
      throw new RuntimeException("Error while modifying class '" + name + "'", e);
    }
  }