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

[3.0] improve AnnotationInstance.hashCode() #335

Merged
merged 1 commit into from
Oct 4, 2023

Conversation

Ladicek
Copy link
Collaborator

@Ladicek Ladicek commented Oct 4, 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 3.0.6 milestone Oct 4, 2023
@Ladicek Ladicek merged commit 0979d8a into smallrye:3.0 Oct 4, 2023
39 checks passed
@Ladicek Ladicek deleted the annotation-hash-code-3.0 branch October 4, 2023 13:56
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.

1 participant