/** * Visits a class literal. If the type of the classnode is a primitive type, the generated * bytecode will be a GETSTATIC Integer.TYPE. If the classnode is not a primitive type, we will * generate a LDC instruction. */ public static void visitClassLiteral(MethodVisitor mv, ClassNode classNode) { if (ClassHelper.isPrimitiveType(classNode)) { mv.visitFieldInsn( GETSTATIC, getClassInternalName(ClassHelper.getWrapper(classNode)), "TYPE", "Ljava/lang/Class;"); } else { mv.visitLdcInsn(org.objectweb.asm.Type.getType(getTypeDescription(classNode))); } }
public static String getTypeDescription(Class c) { return org.objectweb.asm.Type.getDescriptor(c); }
public static String getClassInternalName(Class t) { return org.objectweb.asm.Type.getInternalName(t); }