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 sametarget
. However, theAnnotationInstance.hashCode()
method does not take thetarget
into account at all, which leads to hash table collisions. This commit uses theAnnotationTarget
information to spread out theAnnotationInstance
hash code to make collisions less likely.