< prev index next >

src/java.base/share/classes/java/lang/reflect/UndeclaredThrowableException.java

Print this page

        

@@ -60,10 +60,11 @@
  * @author      Peter Jones
  * @see         InvocationHandler
  * @since       1.3
  */
 public class UndeclaredThrowableException extends RuntimeException {
+    @java.io.Serial
     static final long serialVersionUID = 330127114055056639L;
 
     /**
      * Constructs an {@code UndeclaredThrowableException} with the
      * specified {@code Throwable}.

@@ -106,19 +107,21 @@
     /**
      * Serializable fields for UndeclaredThrowableException.
      *
      * @serialField undeclaredThrowable Throwable
      */
+    @java.io.Serial
     private static final ObjectStreamField[] serialPersistentFields = {
         new ObjectStreamField("undeclaredThrowable", Throwable.class)
     };
 
     /*
      * Reconstitutes the UndeclaredThrowableException instance from a stream
      * and initialize the cause properly when deserializing from an older
      * version.
      */
+    @java.io.Serial
     private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException {
         ObjectInputStream.GetField fields = s.readFields();
         Throwable exception = (Throwable) fields.get("undeclaredThrowable", null);
         if (exception != null) {
             SharedSecrets.getJavaLangAccess().setCause(this, exception);

@@ -127,10 +130,11 @@
 
     /*
      * 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("undeclaredThrowable", super.getCause());
         out.writeFields();
     }
< prev index next >