[OJB-developers] bug in ClassDescriptor.getDynamicProxyClass
Brought to you by:
thma
From: Georg S. <ge...@me...> - 2002-06-07 11:54:32
|
Hi Thomas and Jacob, First of all sorry for always bugging you two to put patches in, but I simply don't know who is responsible for what part. Is there a list of who maintains what, if not it would be a good idea to make one :-). The bug: getDynamicProxyClass creates a proxy class implementing all interfaces of the original class. In order to do this it first calls getInterfaces() on the class to be proxied and then iterates over all the superclasses to do the same. This works fine if the original class is a real class, which is almost always the case. Unfortunately when using a reference-proxy the item class can be an interface itself and when getInterfaces() is called on an interface it returns only the extending interfaces, not the interface itself. Fix: Put the following lines in the method getDynamicProxyClass() in ClassDescriptor Class[] interfaces = clazz.getInterfaces(); ==>add from here on if (clazz.isInterface()) { Class[] tempInterfaces = new Class[interfaces.length + 1]; tempInterfaces[0] = clazz; System.arraycopy(interfaces,0,tempInterfaces,1,interfaces.length); interfaces = tempInterfaces; } Cheers Georg |