Skip to content

Ensure custom KProperty include the name in the hashcode #1731

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

Merged
merged 1 commit into from
Jun 6, 2025

Conversation

vbabanin
Copy link
Member

@vbabanin vbabanin commented Jun 6, 2025

Backport of #1710

The pathCache utilised the string representation of the KProperty instance. The custom implementations didn't include the calculated path value, this can lead to naming collisions in the pathCache key.

This commit adds hashCode and equals methods to ensure the name value is included in our custom implementations of KProperty1. Finally, the cache key now uses the hashCode for the cacheKey.

JAVA-5868

The `pathCache` utilised the string representation of the KProperty instance.
The custom implementations didn't include the calculated `path` value, this can
lead to naming collisions in the `pathCache` key.

This commit adds `hashCode` and `equals` methods to ensure the `name` value is included
in our custom implementations of `KProperty1`. Finally, the cache key now uses the `hashCode`
for the cacheKey.

JAVA-5868

(cherry picked from commit 172327b)
@vbabanin vbabanin requested a review from katcharov June 6, 2025 16:21
@vbabanin vbabanin changed the title Ensure custom KProperty include the name in the hashcode (#1710) Ensure custom KProperty include the name in the hashcode Jun 6, 2025
@vbabanin vbabanin self-assigned this Jun 6, 2025
Copy link
Collaborator

@katcharov katcharov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@vbabanin vbabanin merged commit ebdd5bf into mongodb:5.5.x Jun 6, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants