/** * pushes an array of the specified size to the method visitor. The generated bytecode will leave * the new array at the top of the stack. * * @param mv MethodVisitor to use * @param size Size of the array to create * @param type Type of array to create * @throws ProxyGenerationException */ private static void createArrayDefinition(final MethodVisitor mv, final int size, final Class<?> type) throws ProxyGenerationException { // create a new array of java.lang.class (2) if (size < 0) { throw new ProxyGenerationException("Array size cannot be less than zero"); } pushIntOntoStack(mv, size); mv.visitTypeInsn(ANEWARRAY, type.getCanonicalName().replace('.', '/')); }
/** * pushes an array of the specified size to the method visitor. The generated bytecode will leave * the new array at the top of the stack. * * @param mv MethodVisitor to use * @param size Size of the array to create * @param type Type of array to create * @throws ProxyGenerationException */ private static void createArrayDefinition(final MethodVisitor mv, final int size, final Class<?> type) throws ProxyGenerationException { // create a new array of java.lang.class (2) if (size < 0) { throw new ProxyGenerationException("Array size cannot be less than zero"); } pushIntOntoStack(mv, size); mv.visitTypeInsn(ANEWARRAY, type.getCanonicalName().replace('.', '/')); }