RFR 9: 8164908: ReflectionFactory support for IIOP and custom serialization

Alan Bateman Alan.Bateman at oracle.com
Thu Oct 20 12:21:01 UTC 2016

On 19/10/2016 20:59, Roger Riggs wrote:

> The support in sun.reflect.ReflectionFactory for custom serialization, 
> such as IIOP input
> and output streams, is being expanded beyond the necessary constructor 
> of a serializable
> class to include access to the private methods readObject, 
> writeObject, readResolve,
> writeReplace, etc.
> The IIOP implementation is updated to use a combination of 
> ReflectionFactory and
> Unsafe to serialize and deserialize objects and no longer rely on 
> setAccessible.
> Tests are included for ReflectionFactory and the affected IIOP classes.
> Please review and comment,
> jdk repo webrev:
> http://cr.openjdk.java.net/~rriggs/webrev-reflection-factory-8164908/
> corba repo webrev :
> http://cr.openjdk.java.net/~rriggs/webrev-reflection-factory-iiop-8164908/ 
I skimmed through the changes.

I assume findReadWriteObjectForSerialization should throw InternalError, 
rather than return null, if IllegalAccessException is thrown (as IAE is 
not possible here).

You've added @since 9 to sun.reflect.ReflectionFactory but that class is 
not new.

The javadoc for 
sun.reflect.ReflectionFactory.newConstructorForSerialization doesn't say 
that it returns null when the Class is not Serializable.

For the MH returning methods then I assume the javadoc should say that 
it returns a direct method handle.

The synchronization in the IIOP ObjectStreamClass isn't very clear. Are 
the invoke*, read*, write* methods all invoked by the same thread that 
creates the ObjectStreamClass with the lookup method?


More information about the core-libs-dev mailing list