Inclusion of overloaded
in equals()
and hashCode()
for MethodOverride
breaks equals()
in AbstractBeanDefinition
[SPR-11420]
#16047
Labels
in: core
Issues in core modules (aop, beans, core, context, expression)
status: backported
An issue that has been backported to maintenance branches
type: bug
A general bug
Milestone
Sam Brannen opened SPR-11420 and commented
Status Quo
The
overloaded
flag inMethodOverride
is a mutable property that is only intended to be used "to optimize runtime performance" (from the Javadoc), specifically limited to the implementation ofReplaceOverride.matches()
.The
overloaded
flag is, however, currently used to determine equality of and calculate hash codes forMethodOverride
instances.Its value is potentially changed from
true
(the default) tofalse
inAbstractBeanDefinition.validate()
. As a consequence, given two bean definitionsA
andB
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), ifA
has been validated andB
has not, thenA.equals(B)
will potentially returnfalse
, which is not acceptable behavior.Note that
AbstractBeanDefinition.equals()
includes an equality check forMethodOverrides
.Deliverables
overloaded
flag inequals()
andhashCode()
forMethodOverride
.Affects: 3.0 GA
Issue Links:
Backported to: 3.2.8
The text was updated successfully, but these errors were encountered: