guava/src/com/google/common/reflect/AbstractInvocationHandler.java
@Override
  public final Object invoke(Object proxy, Method method, Object @Nullable [] args)
      throws Throwable {
    if (args == null) {
      args = NO_ARGS;
    }
    if (args.length == 0 && method.getName().equals("hashCode")) {
      return hashCode();
    }
    if (args.length == 1
        && method.getName().equals("equals")
        && method.getParameterTypes()[0] == Object.class) {
      Object arg = args[0];
      if (arg == null) {
        return false;
      }
      if (proxy == arg) {
        return true;
      }
      return isProxyOfSameInterfaces(arg, proxy.getClass())
          && equals(Proxy.getInvocationHandler(arg));
    }
    if (args.length == 0 && method.getName().equals("toString")) {
      return toString();
    }
    return handleInvocation(proxy, method, args);
  }
@Override
  public final Object invoke(Object proxy, Method method, Object @Nullable [] args)
      throws Throwable {
    if (args == null) {
      args = NO_ARGS;
    }
    if (args.length == 0 && method.getName().equals("hashCode")) {
      return hashCode();
    }
    if (args.length == 1
        && method.getName().equals("equals")
        && method.getParameterTypes()[0] == Object.class) {
      Object arg = args[0];
      if (arg == null) {
        return false;
      }
      if (proxy == arg) {
        return true;
      }
      return isProxyOfSameInterfaces(arg, proxy.getClass())
          && equals(Proxy.getInvocationHandler(arg));
    }
    if (args.length == 0 && method.getName().equals("toString")) {
      return toString();
    }
    return handleInvocation(proxy, method, args);
  }
@ Override public final Object invoke ( Object proxy , Method method , Object @ Nullable [ ] args ) throws Throwable { if ( args == null ) { args = NO_ARGS ; } if ( args . length == 0 && method . getName ( ) . equals ( "hashCode" ) ) { return hashCode ( ) ; } if ( args . length == 1 && method . getName ( ) . equals ( "equals" ) && method . getParameterTypes ( ) [ 0 ] == Object . class ) { Object arg = args [ 0 ] ; if ( arg == null ) { return false ; } if ( proxy == arg ) { return true ; } return isProxyOfSameInterfaces ( arg , proxy . getClass ( ) ) && equals ( Proxy . getInvocationHandler ( arg ) ) ; } if ( args . length == 0 && method . getName ( ) . equals ( "toString" ) ) { return toString ( ) ; } return handleInvocation ( proxy , method , args ) ; }
{@inheritDoc}

<ul>
<li>{@code proxy.hashCode()} delegates to {@link AbstractInvocationHandler#hashCode}
<li>{@code proxy.toString()} delegates to {@link AbstractInvocationHandler#toString}
<li>{@code proxy.equals(argument)} returns true if:
<ul>
<li>{@code proxy} and {@code argument} are of the same type
<li>and {@link AbstractInvocationHandler#equals} returns true for the {@link
InvocationHandler} of {@code argument}
</ul>
<li>other method calls are dispatched to {@link #handleInvocation}.
</ul>
{ @inheritDoc }