Browse Source

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
tags/rel_3_17_1_ga
adrian 18 years ago
parent
commit
3921e76c51
1 changed files with 16 additions and 1 deletions
  1. 16
    1
      src/main/javassist/bytecode/annotation/AnnotationImpl.java

+ 16
- 1
src/main/javassist/bytecode/annotation/AnnotationImpl.java View 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);

Loading…
Cancel
Save