private ClassNode configureClass(Class c) { if (c.isPrimitive()) { return ClassHelper.make(c); } else { return ClassHelper.makeWithoutCaching(c, false); } }
public static void doCast(MethodVisitor mv, Class type) { if (type == Object.class) return; if (type.isPrimitive() && type != Void.TYPE) { unbox(mv, type); } else { mv.visitTypeInsn( CHECKCAST, type.isArray() ? BytecodeHelper.getTypeDescription(type) : BytecodeHelper.getClassInternalName(type.getName())); } }
/** Generates the bytecode to unbox the current value on the stack */ public static void unbox(MethodVisitor mv, Class type) { if (type.isPrimitive() && type != Void.TYPE) { String returnString = "(Ljava/lang/Object;)" + BytecodeHelper.getTypeDescription(type); mv.visitMethodInsn(INVOKESTATIC, DTT_CLASSNAME, type.getName() + "Unbox", returnString); } }