protected void buildInvokeMethod(Type declaringTypeObject, String methodName, Object returnType, Collection<Object> argumentTypes, GeneratorAdapter invokeMethodVisitor) {
        Type returnTypeObject = getTypeReference(returnType);
        invokeMethodVisitor.visitVarInsn(ALOAD, 1);
        pushCastToType(invokeMethodVisitor, beanFullClassName);
        boolean hasArgs = !argumentTypes.isEmpty();
        String methodDescriptor;
        if (hasArgs) {
            methodDescriptor = getMethodDescriptor(returnType, argumentTypes);
            int argCount = argumentTypes.size();
            Iterator<Object> argIterator = argumentTypes.iterator();
            for (int i = 0; i < argCount; i++) {
                invokeMethodVisitor.visitVarInsn(ALOAD, 2);
                invokeMethodVisitor.push(i);
                invokeMethodVisitor.visitInsn(AALOAD);
                // cast the return value to the correct type
                pushCastToType(invokeMethodVisitor, argIterator.next());
            }
        } else {
            methodDescriptor = getMethodDescriptor(returnType, Collections.emptyList());
        }

        invokeMethodVisitor.visitMethodInsn(isInterface ? INVOKEINTERFACE : INVOKEVIRTUAL,
            declaringTypeObject.getInternalName(), methodName,
            methodDescriptor, isInterface);

        if (returnTypeObject.equals(Type.VOID_TYPE)) {
            invokeMethodVisitor.visitInsn(ACONST_NULL);
        } else {
            pushBoxPrimitiveIfNecessary(returnType, invokeMethodVisitor);
        }
        invokeMethodVisitor.visitInsn(ARETURN);

        invokeMethodVisitor.visitMaxs(DEFAULT_MAX_STACK, 1);
        invokeMethodVisitor.visitEnd();
    }
protected void buildInvokeMethod ( Type declaringTypeObject , String methodName , Object returnType , Collection < Object > argumentTypes , GeneratorAdapter invokeMethodVisitor ) { Type returnTypeObject = getTypeReference ( returnType ) ; invokeMethodVisitor . visitVarInsn ( ALOAD , 1 ) ; pushCastToType ( invokeMethodVisitor , beanFullClassName ) ; boolean hasArgs = ! argumentTypes . isEmpty ( ) ; String methodDescriptor ; if ( hasArgs ) { methodDescriptor = getMethodDescriptor ( returnType , argumentTypes ) ; int argCount = argumentTypes . size ( ) ; Iterator < Object > argIterator = argumentTypes . iterator ( ) ; for ( int i = 0 ; i < argCount ; i ++ ) { invokeMethodVisitor . visitVarInsn ( ALOAD , 2 ) ; invokeMethodVisitor . push ( i ) ; invokeMethodVisitor . visitInsn ( AALOAD ) ; pushCastToType ( invokeMethodVisitor , argIterator . next ( ) ) ; } } else { methodDescriptor = getMethodDescriptor ( returnType , Collections . emptyList ( ) ) ; } invokeMethodVisitor . visitMethodInsn ( isInterface ? INVOKEINTERFACE : INVOKEVIRTUAL , declaringTypeObject . getInternalName ( ) , methodName , methodDescriptor , isInterface ) ; if ( returnTypeObject . equals ( Type . VOID_TYPE ) ) { invokeMethodVisitor . visitInsn ( ACONST_NULL ) ; } else { pushBoxPrimitiveIfNecessary ( returnType , invokeMethodVisitor ) ; } invokeMethodVisitor . visitInsn ( ARETURN ) ; invokeMethodVisitor . visitMaxs ( DEFAULT_MAX_STACK , 1 ) ; invokeMethodVisitor . visitEnd ( ) ; }
@param declaringTypeObject The declaring object type
@param methodName          The method name
@param returnType          The return type
@param argumentTypes       The argument types
@param invokeMethodVisitor The invoke method visitor