Annotate AbstractRaftRPC with java.io.Serial
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / messages / RequestVote.java
index b23c76d06f9213d516f0f2a7345f85034c157333..2ac4d7e355481da2cfa5a1b37d6b1015363191a7 100644 (file)
@@ -16,6 +16,7 @@ import java.io.ObjectOutput;
  * Invoked by candidates to gather votes (ยง5.2).
  */
 public final class RequestVote extends AbstractRaftRPC {
+    @java.io.Serial
     private static final long serialVersionUID = -6967509186297108657L;
 
     // candidate requesting vote
@@ -57,10 +58,12 @@ public final class RequestVote extends AbstractRaftRPC {
 
     @Override
     Object writeReplace() {
-        return new Proxy(this);
+        return new RV(this);
     }
 
+    @Deprecated(since = "7.0.0", forRemoval = true)
     private static class Proxy implements Externalizable {
+        @java.io.Serial
         private static final long serialVersionUID = 1L;
 
         private RequestVote requestVote;
@@ -71,16 +74,9 @@ public final class RequestVote extends AbstractRaftRPC {
         public Proxy() {
         }
 
-        Proxy(final RequestVote requestVote) {
-            this.requestVote = requestVote;
-        }
-
         @Override
-        public void writeExternal(final ObjectOutput out) throws IOException {
-            out.writeLong(requestVote.getTerm());
-            out.writeObject(requestVote.candidateId);
-            out.writeLong(requestVote.lastLogIndex);
-            out.writeLong(requestVote.lastLogTerm);
+        public void writeExternal(final ObjectOutput out) {
+            throw new UnsupportedOperationException();
         }
 
         @Override
@@ -93,6 +89,7 @@ public final class RequestVote extends AbstractRaftRPC {
             requestVote = new RequestVote(term, candidateId, lastLogIndex, lastLogTerm);
         }
 
+        @java.io.Serial
         private Object readResolve() {
             return requestVote;
         }