/** * Insert the appropriate CHECKCAST instruction for the supplied descriptor. * @param mv the target visitor into which the instruction should be inserted * @param descriptor the descriptor of the type to cast to */ public static void insertCheckCast(MethodVisitor mv, @Nullable String descriptor) { if (descriptor != null && descriptor.length() != 1) { if (descriptor.charAt(0) == '[') { if (isPrimitiveArray(descriptor)) { mv.visitTypeInsn(CHECKCAST, descriptor); } else { mv.visitTypeInsn(CHECKCAST, descriptor + ";"); } } else { if (!descriptor.equals("Ljava/lang/Object")) { // This is chopping off the 'L' to leave us with "java/lang/String" mv.visitTypeInsn(CHECKCAST, descriptor.substring(1)); } } } }
/** * Insert the appropriate CHECKCAST instruction for the supplied descriptor. * @param mv the target visitor into which the instruction should be inserted * @param descriptor the descriptor of the type to cast to */ public static void insertCheckCast(MethodVisitor mv, @Nullable String descriptor) { if (descriptor != null && descriptor.length() != 1) { if (descriptor.charAt(0) == '[') { if (isPrimitiveArray(descriptor)) { mv.visitTypeInsn(CHECKCAST, descriptor); } else { mv.visitTypeInsn(CHECKCAST, descriptor + ";"); } } else { if (!descriptor.equals("Ljava/lang/Object")) { // This is chopping off the 'L' to leave us with "java/lang/String" mv.visitTypeInsn(CHECKCAST, descriptor.substring(1)); } } } }
(CodeFlow.isPrimitiveArray(this.exitTypeDescriptor) ? "" : ";"));
(CodeFlow.isPrimitiveArray(this.exitTypeDescriptor) ? "" : ";"));
/** * Insert the appropriate CHECKCAST instruction for the supplied descriptor. * @param mv the target visitor into which the instruction should be inserted * @param descriptor the descriptor of the type to cast to */ public static void insertCheckCast(MethodVisitor mv, @Nullable String descriptor) { if (descriptor != null && descriptor.length() != 1) { if (descriptor.charAt(0) == '[') { if (isPrimitiveArray(descriptor)) { mv.visitTypeInsn(CHECKCAST, descriptor); } else { mv.visitTypeInsn(CHECKCAST, descriptor + ";"); } } else { if (!descriptor.equals("Ljava/lang/Object")) { // This is chopping off the 'L' to leave us with "java/lang/String" mv.visitTypeInsn(CHECKCAST, descriptor.substring(1)); } } } }
(CodeFlow.isPrimitiveArray(this.exitTypeDescriptor) ? "" : ";"));