-
Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Sam Brannen opened SPR-11420 and commented
Status Quo
The overloaded flag in MethodOverride is a mutable property that is only intended to be used "to optimize runtime performance" (from the Javadoc), specifically limited to the implementation of ReplaceOverride.matches().
The overloaded flag is, however, currently used to determine equality of and calculate hash codes for MethodOverride instances.
Its value is potentially changed from true (the default) to false in AbstractBeanDefinition.validate(). As a consequence, given two bean definitions A and B that represent the exact same bean definition metadata for a bean that relies on method injection (perhaps loaded via separate application contexts in the same VM), if A has been validated and B has not, then A.equals(B) will potentially return false, which is not acceptable behavior.
Note that AbstractBeanDefinition.equals() includes an equality check for MethodOverrides.
Deliverables
- Stop including the
overloadedflag inequals()andhashCode()forMethodOverride.
Affects: 3.0 GA
Issue Links:
- Method injection causes memory leak [SPR-10785] #15411 Method injection causes memory leak ("is depended on by")
- Method injection causes memory leak [SPR-10785] #15411 Method injection causes memory leak
Backported to: 3.2.8