}
if (arg == Void.TYPE || target == Void.TYPE) {
return;
}
if (arg.isPrimitive()) {
Wrapper wArg = Wrapper.forPrimitiveType(arg);
if (target.isPrimitive()) {
// Both primitives: widening
widen(wArg, Wrapper.forPrimitiveType(target));
} else {
// Primitive argument to reference target
String dTarget = BytecodeDescriptor.unparse(target);
Wrapper wPrimTarget = wrapperOrNullFromDescriptor(dTarget);
if (wPrimTarget != null) {
// The target is a boxed primitive type, widen to get there before boxing
widen(wArg, wPrimTarget);
box(wPrimTarget);
} else {
// Otherwise, box and cast
box(wArg);
cast(wrapperName(wArg), dTarget);
}
}
} else {
String dArg = BytecodeDescriptor.unparse(arg);
String dSrc;
if (functional.isPrimitive()) {
dSrc = dArg;
} else {
// Cast to convert to possibly more specific type, and generate CCE for invalid arg
dSrc = BytecodeDescriptor.unparse(functional);
cast(dArg, dSrc);
}
String dTarget = BytecodeDescriptor.unparse(target);
if (target.isPrimitive()) {
Wrapper wTarget = toWrapper(dTarget);
// Reference argument to primitive target
Wrapper wps = wrapperOrNullFromDescriptor(dSrc);
if (wps != null) {
if (wps.isSigned() || wps.isFloating()) {
// Boxed number to primitive
unbox(wrapperName(wps), wTarget);
} else {
// Character or Boolean
unbox(wrapperName(wps), wps);