From 511dab1ade9c8b45d35e3bca005b631f0c40af89 Mon Sep 17 00:00:00 2001 From: diguage Date: Sun, 18 Dec 2022 19:46:15 +0800 Subject: [PATCH] Apply "instanceof pattern matching" (#29710) --- .../aop/framework/DefaultAdvisorChainFactory.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAdvisorChainFactory.java b/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAdvisorChainFactory.java index 67e435a8835..88c66b1ec7b 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAdvisorChainFactory.java +++ b/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)) { MethodMatcher mm = pointcutAdvisor.getPointcut().getMethodMatcher(); boolean match; - if (mm instanceof IntroductionAwareMethodMatcher) { + if (mm instanceof IntroductionAwareMethodMatcher iamm) { if (hasIntroductions == null) { hasIntroductions = hasMatchingIntroductions(advisors, actualClass); } - match = ((IntroductionAwareMethodMatcher) mm).matches(method, actualClass, hasIntroductions); + match = iamm.matches(method, actualClass, hasIntroductions); } else { match = mm.matches(method, actualClass);