//
// Construct field for the handler reference
//
Class handlerClass = handlerMethodRef.getDeclaringClass();
FieldGen handlerFieldGen = new FieldGen(Constants.ACC_PRIVATE
| Constants.ACC_FINAL, translate(handlerClass), Util
.handlerFieldName(), cp);
newStubClass.addField(handlerFieldGen.getField());
//
// Construct the method that gets the stub handler.
//
generateHandlerGetter(newStubClass, handlerFieldGen);
//
// construct the field that holds the initializer
//
FieldGen initializerFieldGen = new FieldGen(Constants.ACC_PRIVATE
| Constants.ACC_STATIC, translate(StubInitializer.class), Util
.initializerFieldName(), cp);
newStubClass.addField(initializerFieldGen.getField());
//
// Emit constructor
//
emitInitializerConstructor(newStubClass, handlerFieldGen,
initializerFieldGen);
//
// Construct data fields
//
FieldGen[] dataFieldGens = new FieldGen[methods.length];
for (int i = 0; i < methods.length; i++) {
MethodRef method = methods[i];
dataFieldGens[i] = new FieldGen(Constants.ACC_PRIVATE
| Constants.ACC_STATIC, typeOfDataFields, Util
.methodFieldName(i), cp);
newStubClass.addField(dataFieldGens[i].getField());
}