[
https://issues.jboss.org/browse/CDI-630?page=com.atlassian.jira.plugin.sy...
]
Martin Kouba updated CDI-630:
-----------------------------
Description:
Currently, {{AnnotationLiteral.hashCode()}} always returns {{0}} if there are no members
(ignoring annotation type completely). Although it does not break {{Object.hashCode()}}
contract, I believe we should -either return a number based on the annotation type (to
make the annotation literal instances more usable in hash tables) or- simply return zero
and don't cache the value at all.
UPDATE: We may not return a number based on the annotation type because it would break the
{{java.lang.annotation.Annotation.hashCode()}} contract.
was:Currently, {{AnnotationLiteral.hashCode()}} always returns {{0}} if there are no
members (ignoring annotation type completely). Although it does not break
{{Object.hashCode()}} contract, I believe we should either return a number based on the
annotation type (to make the annotation literal instances more usable in hash tables) or
simply return zero and don't cache the value at all.
Revise javax.enterprise.util.AnnotationLiteral.cachedHashCode
-------------------------------------------------------------
Key: CDI-630
URL:
https://issues.jboss.org/browse/CDI-630
Project: CDI Specification Issues
Issue Type: Feature Request
Reporter: Martin Kouba
Priority: Optional
Fix For: 2.0 (discussion)
Currently, {{AnnotationLiteral.hashCode()}} always returns {{0}} if there are no members
(ignoring annotation type completely). Although it does not break {{Object.hashCode()}}
contract, I believe we should -either return a number based on the annotation type (to
make the annotation literal instances more usable in hash tables) or- simply return zero
and don't cache the value at all.
UPDATE: We may not return a number based on the annotation type because it would break
the {{java.lang.annotation.Annotation.hashCode()}} contract.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)