[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: JBMDR-51; Annotation equals is completely broken

adrian@jboss.org do-not-reply at jboss.com
Mon Nov 3 08:04:25 EST 2008


"alesj" wrote : "alesj" wrote : 
  |   | Too late, re-invented. :-)
  |   | 
  |   |   |             if (Objects.isArray(value))
  |   |   |             {
  |   |   |                if (Objects.isArray(other) == false)
  |   |   |                   return Boolean.FALSE;
  |   |   | 
  |   |   |                int length = Array.getLength(value);
  |   |   |                if (length != Array.getLength(other))
  |   |   |                   return Boolean.FALSE;
  |   |   | 
  |   |   |                for (int i = 0; i < length; i++)
  |   |   |                {
  |   |   |                   if (JBossObject.equals(Array.get(value, i), Array.get(other, i)) == false)
  |   |   |                      return Boolean.FALSE;
  |   |   |                }
  |   |   |             }
  |   |   | 
  | As annotation can only take single dimension arrays as values this is fine.
  | But since I'm already fixing this:
  |  - http://lists.jboss.org/pipermail/jboss-development/2008-October/012837.html
  | I'll add a generic (recursive) arrays equal to common-core.
  | Unless this is already done somewhere, and I just cannot find it. ;-)


  | What's wrong with Arrays.equals(Object[], Object[])?
  | 

The square brackets probably don't show properly above? :-)

Also, javassist has an annotation implementation that does equals and hashcode
correctly (including default values).

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4186379#4186379

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4186379



More information about the jboss-dev-forums mailing list