dangdangdotcom / dubbox

Dubbox now means Dubbo eXtensions, and it adds features like RESTful remoting, Kyro/FST serialization, etc to the Dubbo service framework.
http://dangdangdotcom.github.io/dubbox
Apache License 2.0
4.89k stars 2.06k forks source link

findMethodByMethodSignature方法有一个bug #335

Open SimonHunag opened 7 years ago

SimonHunag commented 7 years ago

String signature = methodName;
        if(parameterTypes != null && parameterTypes.length > 0){
            signature = methodName + StringUtils.join(parameterTypes);
        }
        Method method = Signature_METHODS_CACHE.get(signature);
        if(method != null){
            return method;
        }

很明显的看是根据方法名与参数类型来确定的signature,如果我所有的接口中都有一个方法updateBatch, 参数类型问List,那么就有问题了,生产的signature都是一样的。 因此我觉得需要加上className。 因此需要修改方法 findMethodByMethodSignature

public static Method findMethodByMethodSignature(Class<?> clazz, String methodName, String[] parameterTypes)
            throws NoSuchMethodException, ClassNotFoundException {
        String signature = methodName;
        if(parameterTypes != null && parameterTypes.length > 0){
            signature =clazz.getName() + methodName + StringUtils.join(parameterTypes);
        }
        Method method = Signature_METHODS_CACHE.get(signature);