On 04/05/2016 20:29, Mandy Chung wrote:
The default implementation of ObjectInputStream::resolveClass and
resolveProxyClass finds the user-defined class loader on the stack and assumes
that only system classes are loaded by null loader. As JDK modules are
deprivileged, classes on the stack defined by the platform class loader.
These methods should be updated to prepare if any system class are defined by
the platform class loader and its ancestors instead.
As for the implementation, I fix JVM_LatestUserDefinedLoader to returns the
first non-null class loader on the stack that is not platform class loader.
This is so fragile and would be really nice if this could go away while the
past work shows that it’s unlikely - Alan may say more on this. If this stays,
I’d like this to be replaced with StackWalker API and remove such built-in
logic in the VM in the future.
Webrev:
http://cr.openjdk.java.net/~mchung/jdk9/webrevs/8155977/webrev.00/
In resolveClass then "is class loader corresponding to the closest .."
should probably be "is the class loader ...". You didn't introduce this
of course, just noticed it while reading the complete paragraph.
The rest looks okay to me, no objection to Chris's suggestion to re-word
resolveProxyClass.
-Alan