sandbox/src/main/java/org/robolectric/internal/bytecode/ShadowDecorator.java
@Override
  public void decorateMethodPreClassHandler(MutableClass mutableClass, MethodNode originalMethod,
      String originalMethodName, RobolectricGeneratorAdapter generator) {
    boolean isNormalInstanceMethod = !generator.isStatic
        && !originalMethodName.equals(ShadowConstants.CONSTRUCTOR_METHOD_NAME);
    // maybe perform direct call...
    if (isNormalInstanceMethod) {
      int exceptionLocalVar = generator.newLocal(THROWABLE_TYPE);
      Label notInstanceOfThis = new Label();

      generator.loadThis();                                         // this
      generator.getField(mutableClass.classType, ShadowConstants.CLASS_HANDLER_DATA_FIELD_NAME, OBJECT_TYPE);  // contents of this.__robo_data__
      generator.instanceOf(mutableClass.classType);                 // __robo_data__, is instance of same class?
      generator.visitJumpInsn(Opcodes.IFEQ, notInstanceOfThis);     // jump if no (is not instance)

      TryCatch tryCatchForProxyCall = generator.tryStart(THROWABLE_TYPE);
      generator.loadThis();                                         // this
      generator.getField(mutableClass.classType, ShadowConstants.CLASS_HANDLER_DATA_FIELD_NAME, OBJECT_TYPE);  // contents of this.__robo_data__
      generator.checkCast(mutableClass.classType);                  // __robo_data__ but cast to my class
      generator.loadArgs();                                         // __robo_data__ instance, [args]

      generator.visitMethodInsn(Opcodes.INVOKESPECIAL, mutableClass.internalClassName, originalMethod.name, originalMethod.desc, false);
      tryCatchForProxyCall.end();

      generator.returnValue();

      // catch(Throwable)
      tryCatchForProxyCall.handler();
      generator.storeLocal(exceptionLocalVar);
      generator.loadLocal(exceptionLocalVar);
      generator.invokeStatic(ROBOLECTRIC_INTERNALS_TYPE, HANDLE_EXCEPTION_METHOD);
      generator.throwException();

      // callClassHandler...
      generator.mark(notInstanceOfThis);
    }
  }
@Override
  public void decorateMethodPreClassHandler(MutableClass mutableClass, MethodNode originalMethod,
      String originalMethodName, RobolectricGeneratorAdapter generator) {
    boolean isNormalInstanceMethod = !generator.isStatic
        && !originalMethodName.equals(ShadowConstants.CONSTRUCTOR_METHOD_NAME);
    // maybe perform direct call...
    if (isNormalInstanceMethod) {
      int exceptionLocalVar = generator.newLocal(THROWABLE_TYPE);
      Label notInstanceOfThis = new Label();

      generator.loadThis();                                         // this
      generator.getField(mutableClass.classType, ShadowConstants.CLASS_HANDLER_DATA_FIELD_NAME, OBJECT_TYPE);  // contents of this.__robo_data__
      generator.instanceOf(mutableClass.classType);                 // __robo_data__, is instance of same class?
      generator.visitJumpInsn(Opcodes.IFEQ, notInstanceOfThis);     // jump if no (is not instance)

      TryCatch tryCatchForProxyCall = generator.tryStart(THROWABLE_TYPE);
      generator.loadThis();                                         // this
      generator.getField(mutableClass.classType, ShadowConstants.CLASS_HANDLER_DATA_FIELD_NAME, OBJECT_TYPE);  // contents of this.__robo_data__
      generator.checkCast(mutableClass.classType);                  // __robo_data__ but cast to my class
      generator.loadArgs();                                         // __robo_data__ instance, [args]

      generator.visitMethodInsn(Opcodes.INVOKESPECIAL, mutableClass.internalClassName, originalMethod.name, originalMethod.desc, false);
      tryCatchForProxyCall.end();

      generator.returnValue();

      // catch(Throwable)
      tryCatchForProxyCall.handler();
      generator.storeLocal(exceptionLocalVar);
      generator.loadLocal(exceptionLocalVar);
      generator.invokeStatic(ROBOLECTRIC_INTERNALS_TYPE, HANDLE_EXCEPTION_METHOD);
      generator.throwException();

      // callClassHandler...
      generator.mark(notInstanceOfThis);
    }
  }
@ Override public void decorateMethodPreClassHandler ( MutableClass mutableClass , MethodNode originalMethod , String originalMethodName , RobolectricGeneratorAdapter generator ) { boolean isNormalInstanceMethod = ! generator . isStatic && ! originalMethodName . equals ( ShadowConstants . CONSTRUCTOR_METHOD_NAME ) ; // maybe perform direct call... if ( isNormalInstanceMethod ) { int exceptionLocalVar = generator . newLocal ( THROWABLE_TYPE ) ; Label notInstanceOfThis = new Label ( ) ; generator . loadThis ( ) ; // this generator . getField ( mutableClass . classType , ShadowConstants . CLASS_HANDLER_DATA_FIELD_NAME , OBJECT_TYPE ) ; // contents of this.__robo_data__ generator . instanceOf ( mutableClass . classType ) ; // __robo_data__, is instance of same class? generator . visitJumpInsn ( Opcodes . IFEQ , notInstanceOfThis ) ; // jump if no (is not instance) TryCatch tryCatchForProxyCall = generator . tryStart ( THROWABLE_TYPE ) ; generator . loadThis ( ) ; // this generator . getField ( mutableClass . classType , ShadowConstants . CLASS_HANDLER_DATA_FIELD_NAME , OBJECT_TYPE ) ; // contents of this.__robo_data__ generator . checkCast ( mutableClass . classType ) ; // __robo_data__ but cast to my class generator . loadArgs ( ) ; // __robo_data__ instance, [args] generator . visitMethodInsn ( Opcodes . INVOKESPECIAL , mutableClass . internalClassName , originalMethod . name , originalMethod . desc , false ) ; tryCatchForProxyCall . end ( ) ; generator . returnValue ( ) ; // catch(Throwable) tryCatchForProxyCall . handler ( ) ; generator . storeLocal ( exceptionLocalVar ) ; generator . loadLocal ( exceptionLocalVar ) ; generator . invokeStatic ( ROBOLECTRIC_INTERNALS_TYPE , HANDLE_EXCEPTION_METHOD ) ; generator . throwException ( ) ; // callClassHandler... generator . mark ( notInstanceOfThis ) ; } }
For non-invokedynamic JVMs, generates this code:
```java
if (__robo_data__ instanceof ThisClass) {
try {
return __robo_data__.$$robo$$originalMethod(params);
} (Throwable t) {
throw RobolectricInternals.cleanStackTrace(t);
}
}
```

Note that this method is only called by {@link OldClassInstrumentor}.
For non - invokedynamic JVMs generates this code : java if ( __robo_data__ instanceof ThisClass ) { try { return __robo_data__ . $$robo$$originalMethod ( params ) ; } ( Throwable t ) { throw RobolectricInternals . cleanStackTrace ( t ) ; } }