Skip to content
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

[2.4] improve AnnotationInstance.hashCode() #332

Merged
merged 1 commit into from Sep 25, 2023
Merged

Conversation

Ladicek
Copy link
Collaborator

@Ladicek Ladicek commented Sep 25, 2023

The AnnotationInstance.equals() method considers two annotations that are basically the same as distinct if they don't have the same target. However, the AnnotationInstance.hashCode() method does not take the target into account at all, which leads to hash table collisions. This commit uses the AnnotationTarget information to spread out the AnnotationInstance hash code to make collisions less likely.

The `AnnotationInstance.equals()` method considers two annotations that are
basically the same as distinct if they don't have the same `target`. However,
the `AnnotationInstance.hashCode()` method does not take the `target` into
account at all, which leads to hash table collisions. This commit uses
the `AnnotationTarget` information to spread out the `AnnotationInstance`
hash code to make collisions less likely.
@Ladicek Ladicek added this to the 2.4.4.Final milestone Sep 25, 2023
@Ladicek Ladicek merged commit 550eb3b into smallrye:2.4 Sep 25, 2023
6 checks passed
@Ladicek Ladicek deleted the 2.4-fixes branch September 25, 2023 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant