public AtomicFactory(Class<T> _class, Class<? extends dstm2.factory.Adapter> adapterClass) {
    super(_class);
    synchronized (lock) {                 // BCEL is not thread-safe!
      interfaceName = _class.getName();
      this.adapterClass = adapterClass;
      className = _class.getName() + "$";
      Class[] interfaces = adapterClass.getInterfaces();
      String[] myInterfaces = new String[interfaces.length];
      myInterfaces[0] = _class.getName();
      int i = 1;
      for (Class c : interfaces) {
        if (!c.equals(dstm2.factory.Adapter.class)) {
          myInterfaces[i++] = c.getName();
        }
      }
      _cg = new ClassGen(className,
          "java.lang.Object",
          "Factory.java",
          ACC_PUBLIC | ACC_SUPER,
          myInterfaces);
      _cp = _cg.getConstantPool();
      _factory = new InstructionFactory(_cg, _cp);
      createFields();
      createCtor();
      for (Property p : properties) {
        createGetMethod(p);
        createSetMethod(p);
      }
      for (Class c : interfaces) {
        if (!c.equals(dstm2.factory.Adapter.class)) {
          JavaClass jc = null;
          try {
            jc = Repository.lookupClass(c);
          } catch (java.lang.ClassNotFoundException ex) {
            throw new PanicException("Class not found: " + _class);
          }
          for (Method m : jc.getMethods()) {
            passThrough(c, m);
          }
        }
      }
      createStatic();
      seal();
    }
  }