sandbox/src/main/java/org/robolectric/internal/bytecode/OldClassInstrumentor.java
@Override
  protected void addDirectCallConstructor(MutableClass mutableClass) {
    MethodNode directCallConstructor = new MethodNode(Opcodes.ACC_PUBLIC,
        "<init>", "(" + DIRECT_OBJECT_MARKER_TYPE_DESC + mutableClass.classType.getDescriptor() + ")V", null, null);
    RobolectricGeneratorAdapter generator = new RobolectricGeneratorAdapter(directCallConstructor);
    generator.loadThis();
    String superName = mutableClass.classNode.superName;
    if (superName.equals("java/lang/Object")) {
      generator.visitMethodInsn(Opcodes.INVOKESPECIAL, superName, "<init>", "()V", false);
    } else {
      generator.loadArgs();
      generator.visitMethodInsn(Opcodes.INVOKESPECIAL, superName,
          "<init>", "(" + DIRECT_OBJECT_MARKER_TYPE_DESC + "L" + superName + ";)V", false);
    }
    generator.loadThis();
    generator.loadArg(1);
    generator.putField(mutableClass.classType, ShadowConstants.CLASS_HANDLER_DATA_FIELD_NAME, OBJECT_TYPE);
    generator.returnValue();
    mutableClass.addMethod(directCallConstructor);
  }
@Override
  protected void addDirectCallConstructor(MutableClass mutableClass) {
    MethodNode directCallConstructor = new MethodNode(Opcodes.ACC_PUBLIC,
        "<init>", "(" + DIRECT_OBJECT_MARKER_TYPE_DESC + mutableClass.classType.getDescriptor() + ")V", null, null);
    RobolectricGeneratorAdapter generator = new RobolectricGeneratorAdapter(directCallConstructor);
    generator.loadThis();
    String superName = mutableClass.classNode.superName;
    if (superName.equals("java/lang/Object")) {
      generator.visitMethodInsn(Opcodes.INVOKESPECIAL, superName, "<init>", "()V", false);
    } else {
      generator.loadArgs();
      generator.visitMethodInsn(Opcodes.INVOKESPECIAL, superName,
          "<init>", "(" + DIRECT_OBJECT_MARKER_TYPE_DESC + "L" + superName + ";)V", false);
    }
    generator.loadThis();
    generator.loadArg(1);
    generator.putField(mutableClass.classType, ShadowConstants.CLASS_HANDLER_DATA_FIELD_NAME, OBJECT_TYPE);
    generator.returnValue();
    mutableClass.addMethod(directCallConstructor);
  }
@ Override protected void addDirectCallConstructor ( MutableClass mutableClass ) { MethodNode directCallConstructor = new MethodNode ( Opcodes . ACC_PUBLIC , "<init>" , "(" + DIRECT_OBJECT_MARKER_TYPE_DESC + mutableClass . classType . getDescriptor ( ) + ")V" , null , null ) ; RobolectricGeneratorAdapter generator = new RobolectricGeneratorAdapter ( directCallConstructor ) ; generator . loadThis ( ) ; String superName = mutableClass . classNode . superName ; if ( superName . equals ( "java/lang/Object" ) ) { generator . visitMethodInsn ( Opcodes . INVOKESPECIAL , superName , "<init>" , "()V" , false ) ; } else { generator . loadArgs ( ) ; generator . visitMethodInsn ( Opcodes . INVOKESPECIAL , superName , "<init>" , "(" + DIRECT_OBJECT_MARKER_TYPE_DESC + "L" + superName + ";)V" , false ) ; } generator . loadThis ( ) ; generator . loadArg ( 1 ) ; generator . putField ( mutableClass . classType , ShadowConstants . CLASS_HANDLER_DATA_FIELD_NAME , OBJECT_TYPE ) ; generator . returnValue ( ) ; mutableClass . addMethod ( directCallConstructor ) ; }
Generates code like this:
```java
public ThisClass(DirectObjectMarker dom, ThisClass domInstance) {
super(dom, domInstance);
__robo_data__ = domInstance;
}
```
Generates code like this : java public ThisClass ( DirectObjectMarker dom ThisClass domInstance ) { super ( dom domInstance ) ; __robo_data__ = domInstance ; }