* @throws InvalidObjectException
*/
private void hackClassNameToMatchNewlyCreatedClass(ObjectStreamClass descInstance, Class<?> proxyClass) throws ObjectStreamException {
try {
Field classNameField = descInstance.getClass().getDeclaredField("name");
new FieldSetter(descInstance, classNameField).set(proxyClass.getCanonicalName());
} catch (NoSuchFieldException nsfe) {
// TODO use our own mockito mock serialization exception
throw new MockitoSerializationIssue(join(
"Wow, the class 'ObjectStreamClass' in the JDK don't have the field 'name',",
"this is definitely a bug in our code as it means the JDK team changed a few internal things.",