smallrye / jandex

Java Annotation Indexer
Apache License 2.0
398 stars 94 forks source link

[3.0] improve AnnotationInstance.hashCode() #335

Closed Ladicek closed 1 year ago

Ladicek commented 1 year ago

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.