< prev index next >

src/java.base/share/classes/java/lang/ClassNotFoundException.java

Print this page

        

*** 57,66 **** --- 57,67 ---- */ public class ClassNotFoundException extends ReflectiveOperationException { /** * use serialVersionUID from JDK 1.1.X for interoperability */ + @java.io.Serial private static final long serialVersionUID = 9176873029745254542L; /** * Constructs a <code>ClassNotFoundException</code> with no detail message. */
*** 109,118 **** --- 110,120 ---- /** * Serializable fields for ClassNotFoundException. * * @serialField ex Throwable */ + @java.io.Serial private static final ObjectStreamField[] serialPersistentFields = { new ObjectStreamField("ex", Throwable.class) }; /*
*** 122,131 **** --- 124,134 ---- * * The getException and getCause method returns the private "ex" field * in the older implementation and ClassNotFoundException::cause * was set to null. */ + @java.io.Serial private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException { ObjectInputStream.GetField fields = s.readFields(); Throwable exception = (Throwable) fields.get("ex", null); if (exception != null) { setCause(exception);
*** 134,143 **** --- 137,147 ---- /* * To maintain compatibility with older implementation, write a serial * "ex" field with the cause as the value. */ + @java.io.Serial private void writeObject(ObjectOutputStream out) throws IOException { ObjectOutputStream.PutField fields = out.putFields(); fields.put("ex", super.getCause()); out.writeFields(); }
< prev index next >