Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure ClassFilter and MethodMatcher implementations are cacheable #23659

Closed
12 tasks done
sbrannen opened this issue Sep 18, 2019 · 0 comments
Closed
12 tasks done

Ensure ClassFilter and MethodMatcher implementations are cacheable #23659

sbrannen opened this issue Sep 18, 2019 · 0 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Milestone

Comments

@sbrannen
Copy link
Member

sbrannen commented Sep 18, 2019

Overview

While resolving the regression raised in #23571, it came to our attention that not all of our ClassFilter and MethodMatcher implementations are properly cacheable with CGLIB generated proxies due to missing (or improper) equals() and hashCode() implementations.

Although such deficiencies may not manifest themselves as bugs in Core Spring's default arrangements, these might cause issues in custom arrangements in user applications.

Already Implemented

  • AnnotationClassFilter
  • AspectJExpressionPointcut
  • DefaultIntroductionAdvisor and LockMixinAdvisor
  • DeclareParentsAdvisor - lambda expression in constructor: unnecessary
  • TrueClassFilter: unnecessary due to Singleton pattern
  • TrueMethodMatcher: unnecessary due to Singleton pattern
  • AbstractRegexpMethodPointcut and JdkRegexpMethodPointcut
  • CacheOperationSourcePointcut
  • JCacheOperationSourcePointcut
  • PerTargetInstantiationModelPointcut: unnecessary
  • TransactionAttributeSourcePointcut

Deliverables

Ensure that ClassFilter and MethodMatcher implementations properly implement equals(), hashCode(), and toString().

Potential Bugs

  • RootClassFilter: equals(), hashCode(), and toString()
  • TypePatternClassFilter: equals(), hashCode(), and toString()
  • AnnotationMethodMatcher: equals() does not include the checkInherited flag

Improvements

  • ControlFlowPointcut: toString()
  • UnionClassFilter: toString()
  • IntersectionClassFilter: toString()
  • IntersectionMethodMatcher and IntersectionIntroductionAwareMethodMatcher: toString()
  • UnionMethodMatcher and UnionIntroductionAwareMethodMatcher: toString()
  • AdviceExcludingMethodMatcher: toString()
  • SetterPointcut and GetterPointcut: toString()
  • NameMatchMethodPointcut: toString()
  • ClassFilterAwareUnionMethodMatcher and ClassFilterAwareUnionIntroductionAwareMethodMatcher: toString()
@sbrannen sbrannen added type: bug A general bug in: core Issues in core modules (aop, beans, core, context, expression) labels Sep 18, 2019
@sbrannen sbrannen added this to the 5.1.10 milestone Sep 18, 2019
@sbrannen sbrannen self-assigned this Sep 18, 2019
sbrannen added a commit to sbrannen/spring-framework that referenced this issue Sep 19, 2019
While resolving the regression raised in spring-projectsgh-23571, it came to our
attention that not all of our ClassFilter and MethodMatcher
implementations were properly cacheable with CGLIB generated proxies
due to missing (or improper) equals() and hashCode() implementations.

Although such deficiencies may not manifest themselves as bugs in Core
Spring's default arrangements, these might cause issues in custom
arrangements in user applications.

This commit addresses this by ensuring that ClassFilter and
MethodMatcher implementations properly implement equals() and
hashCode(). In addition, missing toString() implementations have been
added to improve diagnostics for logging and debugging.

Closes spring-projectsgh-23659
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

1 participant