[cdi-dev] AnnotationLiteral hashCode

Mark Struberg struberg at yahoo.de
Fri Mar 30 13:27:23 EDT 2012


Ok, this sucks but it's ok :)

To be more specific: if you do

public @Default MyBean {}

and MyBean.class.getAnnoations() then this Default Annotation also returns hashCode 0 :(
Thus it's ok that our AnnotationLiteral also returns 0.

LieGrue,
strub



----- Original Message -----
> From: Mark Struberg <struberg at yahoo.de>
> To: cdi-dev <cdi-dev at lists.jboss.org>
> Cc: 
> Sent: Friday, March 30, 2012 5:20 PM
> Subject: [cdi-dev] AnnotationLiteral hashCode
> 
> Hi!
> 
> Today I figured that any AnnotationLiteral of an Annoation without values always 
> returns 0. 
> 
> 
> I guess this is a bug in the api, isn't?
> 
> https://github.com/pmuir/cdi/blob/master/api/src/main/java/javax/enterprise/util/AnnotationLiteral.java
> 
> The important code parts:
>     public int hashCode() {
>         int hashCode = 0;
>         for (Method member : getMembers()) {
> 
> 
> but if there are no members...
> 
> LieGrue,
> strub
> 
> 
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev
> 



More information about the cdi-dev mailing list