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

alesj do-not-reply at jboss.com
Fri Oct 31 06:14:51 EDT 2008


This AnnotationProxy::doEquals looks like it misses a lot of logic. ;-)

  |    private Object doEquals(Object proxy, Object obj)
  |    {
  |       if (obj == proxy)
  |          return Boolean.TRUE;
  |       if (obj == null)
  |          return Boolean.FALSE;
  | 
  |       Class[] intfs = proxy.getClass().getInterfaces();
  |       if (intfs[0].isAssignableFrom(obj.getClass()) == false)
  |       {
  |          return Boolean.FALSE;
  |       }
  |       try
  |       {
  |          Proxy.getInvocationHandler(obj);
  |       }
  |       catch (Exception ex)
  |       {
  |          return Boolean.FALSE;
  |       }
  |       return Boolean.TRUE;
  |    }
  | 
And that last attempt is wrong,
e.g. this is totally legit, but would also fail:

  |       String expr = "@"+Name.class.getName() + "(type=\"type\",subtype=\"subtype\")";
  |       Name n0 = (Name) AnnotationCreator.createAnnotation(expr, Name.class);
  |       Name n2 = new NameImpl("type", "subtype");
  |       assertEquals(n0, n2); // FAILURE -- n2 has no InvocationHandler
  | 

I'll fix the impl, but what to do with release, since we already did 2.0.0.GA?
2.0.1.GA?

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

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



More information about the jboss-dev-forums mailing list