Open
Description
Jordi Llach Fernandez opened DATAMONGO-1353 and commented
Code taken from the intercept method public Object intercept(Object obj, Method method, Object[] args, MethodProxy proxy) throws Throwable
of the above mentioned DefaultDbRefResolver.LazyLoadingInterceptor
...
if (isObjectMethod(method) && Object.class.equals(method.getDeclaringClass())) {
if (ReflectionUtils.isToStringMethod(method)) {
return proxyToString(proxy);
}
if (ReflectionUtils.isEqualsMethod(method)) {
return proxyEquals(proxy, args[0]);
}
if (ReflectionUtils.isHashCodeMethod(method)) {
return proxyHashCode(proxy);
}
// DATAMONGO-1076 - finalize methods should not trigger proxy initialization
if (FINALIZE_METHOD.equals(method)) {
return null;
}
...
}
I do not see any good reason for this check isObjectMethod(method) && Object.class.equals(method.getDeclaringClass()
, and in fact proxyToString
, proxyEquals
and proxyHashCode
implementations could always be used instead of the original ones, preventing the resolution process when for instance a proxy of this kind is stored in a map.
Maybe I am wrong
Affects: 1.7.2 (Fowler SR2)