private void codeUnwrapReturnValue(Class<?> type,DataOutputStream out) throws IOException {
  if (type.isPrimitive()) {
    PrimitiveTypeInfo prim=PrimitiveTypeInfo.get(type);
    out.writeByte(opc_checkcast);
    out.writeShort(cp.getClass(prim.wrapperClassName));
    out.writeByte(opc_invokevirtual);
    out.writeShort(cp.getMethodRef(prim.wrapperClassName,prim.unwrapMethodName,prim.unwrapMethodDesc));
    if (type == int.class || type == boolean.class || type == byte.class || type == char.class || type == short.class) {
      out.writeByte(opc_ireturn);
    }
 else     if (type == long.class) {
      out.writeByte(opc_lreturn);
    }
 else     if (type == float.class) {
      out.writeByte(opc_freturn);
    }
 else     if (type == double.class) {
      out.writeByte(opc_dreturn);
    }
 else {
      throw new AssertionError();
    }
  }
 else {
    out.writeByte(opc_checkcast);
    out.writeShort(cp.getClass(dotToSlash(type.getName())));
    out.writeByte(opc_areturn);
  }
}

private void codeUnwrapReturnValue ( Class < ? > type , DataOutputStream out ) throws IOException { if ( type . isPrimitive ( ) ) { PrimitiveTypeInfo prim = PrimitiveTypeInfo . get ( type ) ; out . writeByte ( opc_checkcast ) ; out . writeShort ( cp . getClass ( prim . wrapperClassName ) ) ; out . writeByte ( opc_invokevirtual ) ; out . writeShort ( cp . getMethodRef ( prim . wrapperClassName , prim . unwrapMethodName , prim . unwrapMethodDesc ) ) ; if ( type == int . class || type == boolean . class || type == byte . class || type == char . class || type == short . class ) { out . writeByte ( opc_ireturn ) ; } else if ( type == long . class ) { out . writeByte ( opc_lreturn ) ; } else if ( type == float . class ) { out . writeByte ( opc_freturn ) ; } else if ( type == double . class ) { out . writeByte ( opc_dreturn ) ; } else { throw new AssertionError ( ) ; } } else { out . writeByte ( opc_checkcast ) ; out . writeShort ( cp . getClass ( dotToSlash ( type . getName ( ) ) ) ) ; out . writeByte ( opc_areturn ) ; } }
generate code for unwrapping a return value of the given type from the invocation handler ' s " invoke " method ( as type object ) to its correct type . the code is written to the supplied stream .
