-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
StringMap: Generalize equals
/hashCode
across implementations
#3675
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
Conversation
Wouldn't it be better to
|
@vy OK |
What should I do about these baseline failures? |
@rschmitt, bump the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks everyone for tackling this pull request!
Just to add my perspective: while ReadOnlyStringMapUtil
initially seemed like a solid solution, introducing it creates a binary incompatibility between log4j-core
2.25.x and log4j-api
2.24.x. Since the main goal of #3669 is to support unit testing, it might be preferable to avoid that incompatibility and take a simpler—albeit slightly less efficient—approach by using ReadOnlyStringMap.toMap()
within the equals()
and hashCode()
implementations.
log4j-api/src/main/java/org/apache/logging/log4j/util/ReadOnlyStringMapUtil.java
Outdated
Show resolved
Hide resolved
log4j-api/src/main/java/org/apache/logging/log4j/spi/DefaultThreadContextMap.java
Show resolved
Hide resolved
This change rewrites the `equals` and `hashCode` implementations throughout the `ReadOnlyStringMap` hierarchy to use a common implementation that supports value-based equality between implementations. Fixes apache#3669.
This change rewrites the
equals
andhashCode
implementations inSortedArrayStringMap
andJdkMapAdapterStringMap
to support value-based equality between the two implementations.Fixes #3669.