]> source.dussan.org Git - javassist.git/commitdiff
Implement the Object methods for the annotation invocation handler.
authoradrian <adrian@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>
Sat, 4 Feb 2006 22:30:09 +0000 (22:30 +0000)
committeradrian <adrian@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>
Sat, 4 Feb 2006 22:30:09 +0000 (22:30 +0000)
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@239 30ef5769-5b8d-40dd-aea6-55b5d6557bb3

src/main/javassist/bytecode/annotation/AnnotationImpl.java

index 466a3f338a870c9db89e6d47a431761791faf16c..60004ae171efd2e7ac195ad2ada258c5fdfdbe05 100644 (file)
@@ -53,7 +53,22 @@ class AnnotationImpl implements InvocationHandler {
     public Object invoke(Object proxy, Method method, Object[] args)
         throws Throwable
     {
-        String name = method.getName();
+       String name = method.getName();
+        if (Object.class == method.getDeclaringClass())
+        {
+           if ("equals".equals(name))
+           {
+              Object obj = args[0];
+              if (obj == null || obj instanceof Proxy == false)
+                 return false;
+              Object other = Proxy.getInvocationHandler(obj);
+              return this.equals(other);
+           }
+           if ("toString".equals(name))
+              return annotation.getTypeName() + '@' + hashCode();
+           if ("hashCode".equals(name))
+              return hashCode();
+        }
         MemberValue mv = annotation.getMemberValue(name);
         if (mv == null)
             return getDefault(name, method);