@Override
  protected Class<?> findClass(String name) throws ClassNotFoundException {
    byte[] classfile;
    try {

      translator.onLoad(PatchGwtClassPool.get(), name);

      try {
        classfile = PatchGwtClassPool.get().get(name).toBytecode();
      } catch (NotFoundException e) {
        return null;
      }
    } catch (Exception e) {
      throw new ClassNotFoundException(
          "caught an exception while obtaining a class file for " + name, e);
    }

    int i = name.lastIndexOf('.');
    if (i != -1) {
      String pname = name.substring(0, i);
      if (getPackage(pname) == null)
        try {
          definePackage(pname, null, null, null, null, null, null, null);
        } catch (IllegalArgumentException e) {
          // ignore.  maybe the package object for the same
          // name has been created just right away.
        }
    }

    classfile = modifiyClass(classfile, name);

    return defineClass(name, classfile, 0, classfile.length);
  }
 public ClientBundleMethodsRegistry(Class<? extends ClientBundle> clazz) {
   try {
     ctClass = PatchGwtClassPool.get().get(clazz.getName());
   } catch (NotFoundException e) {
     throw new RuntimeException("Unable to find class [" + clazz.getName() + "]", e);
   }
 }
  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);
  }