예제 #1
0
파일: Java5.java 프로젝트: bodiam/discobot
 private ClassNode configureClass(Class c) {
   if (c.isPrimitive()) {
     return ClassHelper.make(c);
   } else {
     return ClassHelper.makeWithoutCaching(c, false);
   }
 }
예제 #2
0
 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()));
   }
 }
예제 #3
0
 /** 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);
   }
 }