RFR 8169653: Restore ObjectInputStream::resolveClass call stack default search order

Chris Hegarty chris.hegarty at oracle.com
Mon Nov 21 09:41:35 UTC 2016


JDK-8155977 updated ObjectInputStream::resolveClass, and
resolveProxyClass, to work with the platform class loader, but
inadvertently removed the text describing the order in which the
call stack is searched, for the 'loader'.

The omission, from Java SE 8, is " ... closest such method to the
currently executing frame". Similar text should be reinstated.


diff --git a/src/java.base/share/classes/java/io/ObjectInputStream.java 
b/src/java.base/share/classes/java/io/ObjectInputStream.java
--- a/src/java.base/share/classes/java/io/ObjectInputStream.java
+++ b/src/java.base/share/classes/java/io/ObjectInputStream.java
@@ -661,7 +661,8 @@
       * method on the current thread's stack whose declaring class is not a
       * <a href="../lang/ClassLoader.html#builtinLoaders">
       * <em>platform class</em></a>, then <code>loader</code> is
-     * the class loader of such class; otherwise, <code>loader</code>
+     * the class loader corresponding to the class of the closest such
+     * method to the currently executing frame; otherwise, 
<code>loader</code>
       * is the {@linkplain ClassLoader#getPlatformClassLoader()
       * platform class loader}.  If this call results in a
       * <code>ClassNotFoundException</code> and the name of the passed
@@ -725,7 +726,8 @@
       * method on the current thread's stack whose declaring class is not a
       * <a href="../lang/ClassLoader.html#builtinLoaders">
       * <em>platform class</em></a>, then <code>loader</code> is
-     * the class loader of such class; otherwise, <code>loader</code>
+     * the class loader corresponding to the class of the closest such
+     * method to the currently executing frame; otherwise, 
<code>loader</code>
       * is the {@linkplain ClassLoader#getPlatformClassLoader()
       * platform class loader}.
       * Unless any of the resolved interfaces are non-public, this same 
value

-Chris.

[1] https://bugs.openjdk.java.net/browse/JDK-8155977


More information about the core-libs-dev mailing list