AspectJExpressionPointcut leniently ignores non-composable interfaces

Issue: SPR-17003
This commit is contained in:
Juergen Hoeller
2018-07-22 22:28:48 +02:00
parent f58854f4b9
commit bccff73e2b
2 changed files with 11 additions and 3 deletions

View File

@@ -433,9 +433,15 @@ public class AspectJExpressionPointcut extends AbstractExpressionPointcut
// Note: AspectJ is only going to take Method.getDeclaringClass() into account.
Set<Class<?>> ifcs = ClassUtils.getAllInterfacesForClassAsSet(targetClass);
if (ifcs.size() > 1) {
Class<?> compositeInterface = ClassUtils.createCompositeInterface(
ClassUtils.toClassArray(ifcs), targetClass.getClassLoader());
targetMethod = ClassUtils.getMostSpecificMethod(targetMethod, compositeInterface);
try {
Class<?> compositeInterface = ClassUtils.createCompositeInterface(
ClassUtils.toClassArray(ifcs), targetClass.getClassLoader());
targetMethod = ClassUtils.getMostSpecificMethod(targetMethod, compositeInterface);
}
catch (IllegalArgumentException ex) {
// Implemented interfaces probably expose conflicting method signatures...
// Proceed with original target method.
}
}
}
return getShadowMatch(targetMethod, method);