aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoradrian <adrian@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2006-02-04 22:30:09 +0000
committeradrian <adrian@30ef5769-5b8d-40dd-aea6-55b5d6557bb3>2006-02-04 22:30:09 +0000
commit3921e76c519e2fad34e48e9b7e2b9ef5d4ec24f2 (patch)
tree68258300693dbc2fbb053dcd83c5730b86b561fa
parent7807c07752b8978b55ce18e8c3bb1c5db3086bbe (diff)
downloadjavassist-3921e76c519e2fad34e48e9b7e2b9ef5d4ec24f2.tar.gz
javassist-3921e76c519e2fad34e48e9b7e2b9ef5d4ec24f2.zip
Implement the Object methods for the annotation invocation handler.
git-svn-id: http://anonsvn.jboss.org/repos/javassist/trunk@239 30ef5769-5b8d-40dd-aea6-55b5d6557bb3
-rw-r--r--src/main/javassist/bytecode/annotation/AnnotationImpl.java17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/main/javassist/bytecode/annotation/AnnotationImpl.java b/src/main/javassist/bytecode/annotation/AnnotationImpl.java
index 466a3f33..60004ae1 100644
--- a/src/main/javassist/bytecode/annotation/AnnotationImpl.java
+++ b/src/main/javassist/bytecode/annotation/AnnotationImpl.java
@@ -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);