Browse Source

Apply "instanceof pattern matching" (#29710)

pull/29732/head
diguage 3 years ago committed by GitHub
parent
commit
511dab1ade
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      spring-aop/src/main/java/org/springframework/aop/framework/DefaultAdvisorChainFactory.java

4
spring-aop/src/main/java/org/springframework/aop/framework/DefaultAdvisorChainFactory.java

@ -65,11 +65,11 @@ public class DefaultAdvisorChainFactory implements AdvisorChainFactory, Serializ
if (config.isPreFiltered() || pointcutAdvisor.getPointcut().getClassFilter().matches(actualClass)) { if (config.isPreFiltered() || pointcutAdvisor.getPointcut().getClassFilter().matches(actualClass)) {
MethodMatcher mm = pointcutAdvisor.getPointcut().getMethodMatcher(); MethodMatcher mm = pointcutAdvisor.getPointcut().getMethodMatcher();
boolean match; boolean match;
if (mm instanceof IntroductionAwareMethodMatcher) { if (mm instanceof IntroductionAwareMethodMatcher iamm) {
if (hasIntroductions == null) { if (hasIntroductions == null) {
hasIntroductions = hasMatchingIntroductions(advisors, actualClass); hasIntroductions = hasMatchingIntroductions(advisors, actualClass);
} }
match = ((IntroductionAwareMethodMatcher) mm).matches(method, actualClass, hasIntroductions); match = iamm.matches(method, actualClass, hasIntroductions);
} }
else { else {
match = mm.matches(method, actualClass); match = mm.matches(method, actualClass);

Loading…
Cancel
Save