Ensure custom KProperty include the name in the hashcode by rozza · Pull Request #1710 · mongodb/mongo-java-driver
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 is explicitly created using the same default `Any.toString()` implementation to ensure that all implementations of `KProperty1` use the same logic to create the cacheKey. JAVA-5868
rozza
deleted the
JAVA-5868
branch
vbabanin pushed a commit to vbabanin/mongo-java-driver that referenced this pull request
Jun 6, 2025The `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)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters