src/java.base/share/classes/java/io/ObjectInputStream.java

Print this page
rev 16201 : 8169653: Restore ObjectInputStream::resolveClass call stack default search order
Reviewed-by: dfuchs, mchung

*** 655,670 **** * <p>The default implementation of this method in * <code>ObjectInputStream</code> returns the result of calling * <pre> * Class.forName(desc.getName(), false, loader) * </pre> ! * where <code>loader</code> is determined as follows: if there is a ! * 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> ! * is the {@linkplain ClassLoader#getPlatformClassLoader() * platform class loader}. If this call results in a * <code>ClassNotFoundException</code> and the name of the passed * <code>ObjectStreamClass</code> instance is the Java language keyword * for a primitive type or void, then the <code>Class</code> object * representing that primitive type or void will be returned --- 655,669 ---- * <p>The default implementation of this method in * <code>ObjectInputStream</code> returns the result of calling * <pre> * Class.forName(desc.getName(), false, loader) * </pre> ! * where <code>loader</code> is the first class loader on the current ! * thread's stack (starting from the currently executing method) that is ! * neither the <a href="../lang/ClassLoader.html#builtinLoaders"><em> ! * platform class loader</em></a> nor its ancestor; 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 * <code>ObjectStreamClass</code> instance is the Java language keyword * for a primitive type or void, then the <code>Class</code> object * representing that primitive type or void will be returned
*** 719,734 **** * parameter. The <code>Class</code> object for each interface name * <code>i</code> is the value returned by calling * <pre> * Class.forName(i, false, loader) * </pre> ! * where <code>loader</code> is determined as follows: if there is a ! * 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> ! * is the {@linkplain ClassLoader#getPlatformClassLoader() * platform class loader}. * Unless any of the resolved interfaces are non-public, this same value * of <code>loader</code> is also the class loader passed to * <code>Proxy.getProxyClass</code>; if non-public interfaces are present, * their class loader is passed instead (if more than one non-public --- 718,732 ---- * parameter. The <code>Class</code> object for each interface name * <code>i</code> is the value returned by calling * <pre> * Class.forName(i, false, loader) * </pre> ! * where <code>loader</code> is the first class loader on the current ! * thread's stack (starting from the currently executing method) that is ! * neither the <a href="../lang/ClassLoader.html#builtinLoaders"><em> ! * platform class loader</em></a> nor its ancestor; otherwise, <code> ! * loader</code> is the {@linkplain ClassLoader#getPlatformClassLoader() * platform class loader}. * Unless any of the resolved interfaces are non-public, this same value * of <code>loader</code> is also the class loader passed to * <code>Proxy.getProxyClass</code>; if non-public interfaces are present, * their class loader is passed instead (if more than one non-public
*** 2368,2387 **** private static native void bytesToDoubles(byte[] src, int srcpos, double[] dst, int dstpos, int ndoubles); /** ! * Returns the first non-null and non-platform class loader ! * (not counting class loaders of generated reflection implementation classes) ! * up the execution stack, or null if only code from the bootstrap and ! * platform class loader is on the stack. ! * This method is also called via reflection by the following RMI-IIOP class: ! * ! * com.sun.corba.se.internal.util.JDKClassLoader ! * ! * This method should not be removed or its signature changed without ! * corresponding modifications to the above class. */ private static ClassLoader latestUserDefinedLoader() { return jdk.internal.misc.VM.latestUserDefinedLoader(); } --- 2366,2379 ---- private static native void bytesToDoubles(byte[] src, int srcpos, double[] dst, int dstpos, int ndoubles); /** ! * Returns the first non-null and non-platform class loader (not counting ! * class loaders of generated reflection implementation classes) up the ! * execution stack, or the platform class loader if only code from the ! * bootstrap and platform class loader is on the stack. */ private static ClassLoader latestUserDefinedLoader() { return jdk.internal.misc.VM.latestUserDefinedLoader(); }