@Override @Nullable public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String methodName = method.getName(); if (Object.class == method.getDeclaringClass()) { if (methodName.equals("equals")) { // Only consider equal when proxies are identical. return (proxy == args[0]); } else if (methodName.equals("hashCode")) { return System.identityHashCode(proxy); } } else if ("getAttributes".equals(methodName)) { return getAttributes(); } else if ("visit".equals(methodName)) { visit(args[0]); return null; } else if ("toString".equals(methodName)) { return toString(); } throw new IllegalStateException("Unexpected method invocation: " + method); }
@Override @Nullable public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String methodName = method.getName(); if (Object.class == method.getDeclaringClass()) { if (methodName.equals("equals")) { // Only consider equal when proxies are identical. return (proxy == args[0]); } else if (methodName.equals("hashCode")) { return System.identityHashCode(proxy); } } else if ("getAttributes".equals(methodName)) { return getAttributes(); } else if ("visit".equals(methodName)) { visit(args[0]); return null; } else if ("toString".equals(methodName)) { return toString(); } throw new IllegalStateException("Unexpected method invocation: " + method); }
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String methodName = method.getName(); if (Object.class.equals(method.getDeclaringClass())) { if (methodName.equals("equals")) { // Only consider equal when proxies are identical. return (proxy == args[0]); } else if (methodName.equals("hashCode")) { return System.identityHashCode(proxy); } } else if ("getAttributes".equals(methodName)) { return getAttributes(); } else if ("visit".equals(methodName)) { visit(args[0]); return null; } else if ("toString".equals(methodName)) { return toString(); } throw new IllegalStateException("Unexpected method invocation: " + method); }
@Override @Nullable public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String methodName = method.getName(); if (Object.class == method.getDeclaringClass()) { if (methodName.equals("equals")) { // Only consider equal when proxies are identical. return (proxy == args[0]); } else if (methodName.equals("hashCode")) { return System.identityHashCode(proxy); } } else if ("getAttributes".equals(methodName)) { return getAttributes(); } else if ("visit".equals(methodName)) { visit(args[0]); return null; } else if ("toString".equals(methodName)) { return toString(); } throw new IllegalStateException("Unexpected method invocation: " + method); }
@Override @Nullable public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { String methodName = method.getName(); if (Object.class == method.getDeclaringClass()) { if (methodName.equals("equals")) { // Only consider equal when proxies are identical. return (proxy == args[0]); } else if (methodName.equals("hashCode")) { return System.identityHashCode(proxy); } } else if ("getAttributes".equals(methodName)) { return getAttributes(); } else if ("visit".equals(methodName)) { visit(args[0]); return null; } else if ("toString".equals(methodName)) { return toString(); } throw new IllegalStateException("Unexpected method invocation: " + method); }