Commit 84f8a2e5 by SunWei峰

8月3日

parent 9a4ff3c2
...@@ -1174,7 +1174,9 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess ...@@ -1174,7 +1174,9 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
* @throws BeanDefinitionValidationException in case of validation failure * @throws BeanDefinitionValidationException in case of validation failure
*/ */
protected void prepareMethodOverride(MethodOverride mo) throws BeanDefinitionValidationException { protected void prepareMethodOverride(MethodOverride mo) throws BeanDefinitionValidationException {
// 获取对应类中对应方法的个数
int count = ClassUtils.getMethodCountForName(getBeanClass(), mo.getMethodName()); int count = ClassUtils.getMethodCountForName(getBeanClass(), mo.getMethodName());
// 等于0抛出异常。上面已经验证有方法需要覆盖,这里为0肯定错误
if (count == 0) { if (count == 0) {
throw new BeanDefinitionValidationException( throw new BeanDefinitionValidationException(
"Invalid method override: no method with name '" + mo.getMethodName() + "Invalid method override: no method with name '" + mo.getMethodName() +
...@@ -1182,6 +1184,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess ...@@ -1182,6 +1184,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
} }
else if (count == 1) { else if (count == 1) {
// Mark override as not overloaded, to avoid the overhead of arg type checking. // Mark override as not overloaded, to avoid the overhead of arg type checking.
// 标记MethodOverride暂未被覆盖,避免参数类型检查开销
mo.setOverloaded(false); mo.setOverloaded(false);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment