Hello List,

 

we ran into a problem with javassist when recently upgrading to hibernate 3.3.1.GA, whid did not occur with the previous cglib implementation.

We sometimes make use of the cloneable interface and therefore have declared a public clone() on some objects.

If those objects are initially loaded lazily, even if they are fully initialized later on, a call to the clone() method will result in a java.lang.IllegalAccessError at runtime.

This is caused by the Javassist proxy, which exposes the protected clone() of java.lang.Object instead of the public definition from the interface, which I believe to be a bug.

 

I submitted a proposed fix for this at https://jira.jboss.org/jira/browse/JASSIST-85

The result of the fix is, that the clone method of the target is called, which returns a cloned instance of the target object (not a clone of the proxy object), which is exactly what we need.

 

Maybe someone can give their 2 cent if this is actually desired behavior or if this could cause unwanted side-effects.

 

I believe it's in every case better than the current state (runtime errors), and others seem to have had similar issues as well

(see HHH-1726 and http://preview.tinyurl.com/mpnz9p)

 

Kind regards

Tobias Meyer