void convertType(Class<?> arg,Class<?> target,Class<?> functional){
  if (arg.equals(target) && arg.equals(functional)) {
    return;
  }
  if (arg == Void.TYPE || target == Void.TYPE) {
    return;
  }
  if (arg.isPrimitive()) {
    Wrapper wArg=Wrapper.forPrimitiveType(arg);
    if (target.isPrimitive()) {
      widen(wArg,Wrapper.forPrimitiveType(target));
    }
 else {
      String dTarget=BytecodeDescriptor.unparse(target);
      Wrapper wPrimTarget=wrapperOrNullFromDescriptor(dTarget);
      if (wPrimTarget != null) {
        widen(wArg,wPrimTarget);
        box(wPrimTarget);
      }
 else {
        box(wArg);
        cast(wrapperName(wArg),dTarget);
      }
    }
  }
 else {
    String dArg=BytecodeDescriptor.unparse(arg);
    String dSrc;
    if (functional.isPrimitive()) {
      dSrc=dArg;
    }
 else {
      dSrc=BytecodeDescriptor.unparse(functional);
      cast(dArg,dSrc);
    }
    String dTarget=BytecodeDescriptor.unparse(target);
    if (target.isPrimitive()) {
      Wrapper wTarget=toWrapper(dTarget);
      Wrapper wps=wrapperOrNullFromDescriptor(dSrc);
      if (wps != null) {
        if (wps.isSigned() || wps.isFloating()) {
          unbox(wrapperName(wps),wTarget);
        }
 else {
          unbox(wrapperName(wps),wps);
          widen(wps,wTarget);
        }
      }
 else {
        String intermediate;
        if (wTarget.isSigned() || wTarget.isFloating()) {
          intermediate="java/lang/Number";
        }
 else {
          intermediate=wrapperName(wTarget);
        }
        cast(dSrc,intermediate);
        unbox(intermediate,wTarget);
      }
    }
 else {
      cast(dSrc,dTarget);
    }
  }
}

void convertType ( Class < ? > arg , Class < ? > target , Class < ? > functional ) { if ( arg . equals ( target ) && arg . equals ( functional ) ) { return ; } if ( arg == Void . TYPE || target == Void . TYPE ) { return ; } if ( arg . isPrimitive ( ) ) { Wrapper wArg = Wrapper . forPrimitiveType ( arg ) ; if ( target . isPrimitive ( ) ) { widen ( wArg , Wrapper . forPrimitiveType ( target ) ) ; } else { String dTarget = BytecodeDescriptor . unparse ( target ) ; Wrapper wPrimTarget = wrapperOrNullFromDescriptor ( dTarget ) ; if ( wPrimTarget != null ) { widen ( wArg , wPrimTarget ) ; box ( wPrimTarget ) ; } else { box ( wArg ) ; cast ( wrapperName ( wArg ) , dTarget ) ; } } } else { String dArg = BytecodeDescriptor . unparse ( arg ) ; String dSrc ; if ( functional . isPrimitive ( ) ) { dSrc = dArg ; } else { dSrc = BytecodeDescriptor . unparse ( functional ) ; cast ( dArg , dSrc ) ; } String dTarget = BytecodeDescriptor . unparse ( target ) ; if ( target . isPrimitive ( ) ) { Wrapper wTarget = toWrapper ( dTarget ) ; Wrapper wps = wrapperOrNullFromDescriptor ( dSrc ) ; if ( wps != null ) { if ( wps . isSigned ( ) || wps . isFloating ( ) ) { unbox ( wrapperName ( wps ) , wTarget ) ; } else { unbox ( wrapperName ( wps ) , wps ) ; widen ( wps , wTarget ) ; } } else { String intermediate ; if ( wTarget . isSigned ( ) || wTarget . isFloating ( ) ) { intermediate = "java/lang/Number" ; } else { intermediate = wrapperName ( wTarget ) ; } cast ( dSrc , intermediate ) ; unbox ( intermediate , wTarget ) ; } } else { cast ( dSrc , dTarget ) ; } } }
convert an argument of type ' arg ' to be passed to ' target ' assuring that it is ' functional ' . insert the needed conversion instructions in the method code .
