8232234: Suppress warnings on non-serializable non-transient instance fields in java.rmi
authordarcy
Tue, 15 Oct 2019 13:25:57 -0700
changeset 58609 fbfc72ec8e6b
parent 58605 10db6989907f
child 58639 e0bb6b38a6f6
8232234: Suppress warnings on non-serializable non-transient instance fields in java.rmi Reviewed-by: rriggs
src/java.rmi/share/classes/java/rmi/activation/ActivationGroup.java
src/java.rmi/share/classes/java/rmi/activation/ActivationGroupID.java
src/java.rmi/share/classes/java/rmi/server/UnicastRemoteObject.java
src/java.rmi/share/classes/sun/rmi/server/ActivatableServerRef.java
src/java.rmi/share/classes/sun/rmi/server/Activation.java
src/java.rmi/share/classes/sun/rmi/server/ActivationGroupImpl.java
--- a/src/java.rmi/share/classes/java/rmi/activation/ActivationGroup.java	Tue Oct 15 19:45:09 2019 +0200
+++ b/src/java.rmi/share/classes/java/rmi/activation/ActivationGroup.java	Tue Oct 15 13:25:57 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -107,6 +107,7 @@
     /**
      * @serial the group's monitor
      */
+    @SuppressWarnings("serial") // Not statically typed as Serializable
     private ActivationMonitor monitor;
 
     /**
--- a/src/java.rmi/share/classes/java/rmi/activation/ActivationGroupID.java	Tue Oct 15 19:45:09 2019 +0200
+++ b/src/java.rmi/share/classes/java/rmi/activation/ActivationGroupID.java	Tue Oct 15 13:25:57 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,6 +49,7 @@
     /**
      * @serial The group's activation system.
      */
+    @SuppressWarnings("serial") // Not statically typed as Serializable
     private ActivationSystem system;
 
     /**
--- a/src/java.rmi/share/classes/java/rmi/server/UnicastRemoteObject.java	Tue Oct 15 19:45:09 2019 +0200
+++ b/src/java.rmi/share/classes/java/rmi/server/UnicastRemoteObject.java	Tue Oct 15 13:25:57 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -189,12 +189,14 @@
     /**
      * @serial client-side socket factory (if any)
      */
+    @SuppressWarnings("serial") // Not statically typed as Serializable
     private RMIClientSocketFactory csf = null;
 
     /**
      * @serial server-side socket factory (if any) to use when
      * exporting object
      */
+    @SuppressWarnings("serial") // Not statically typed as Serializable
     private RMIServerSocketFactory ssf = null;
 
     /* indicate compatibility with JDK 1.1.x version of class */
--- a/src/java.rmi/share/classes/sun/rmi/server/ActivatableServerRef.java	Tue Oct 15 19:45:09 2019 +0200
+++ b/src/java.rmi/share/classes/sun/rmi/server/ActivatableServerRef.java	Tue Oct 15 13:25:57 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@
  *
  * @author Ann Wollrath
  */
+@SuppressWarnings("serial") // Externalizable class w/o no-arg c'tor
 public class ActivatableServerRef extends UnicastServerRef2 {
 
     private static final long serialVersionUID = 2002967993223003793L;
--- a/src/java.rmi/share/classes/sun/rmi/server/Activation.java	Tue Oct 15 19:45:09 2019 +0200
+++ b/src/java.rmi/share/classes/sun/rmi/server/Activation.java	Tue Oct 15 13:25:57 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -145,9 +145,11 @@
     private static boolean debugExec;
 
     /** maps activation id to its respective group id */
+    @SuppressWarnings("serial") // Conditionally serializable
     private Map<ActivationID,ActivationGroupID> idTable =
         new ConcurrentHashMap<>();
     /** maps group id to its GroupEntry groups */
+    @SuppressWarnings("serial") // Conditionally serializable
     private Map<ActivationGroupID,GroupEntry> groupTable =
         new ConcurrentHashMap<>();
 
@@ -297,6 +299,7 @@
 
         private static final String NAME = ActivationSystem.class.getName();
         private static final long serialVersionUID = 4877330021609408794L;
+        @SuppressWarnings("serial") // Not statically typed as Serializable
         private ActivationSystem systemStub = null;
 
         SystemRegistryImpl(int port,
@@ -498,6 +501,7 @@
      * with RegistryImpl.checkAccess().
      * The kind of access is retained for an exception if one is thrown.
      */
+    @SuppressWarnings("serial") // Externalizable class w/o no-arg c'tor
     static class SameHostOnlyServerRef extends UnicastServerRef {
         private static final long serialVersionUID = 1234L;
         private String accessKind;      // an exception message
@@ -873,7 +877,9 @@
         ActivationGroupDesc desc = null;
         ActivationGroupID groupID = null;
         long incarnation = 0;
+        @SuppressWarnings("serial") // Conditionally serializable
         Map<ActivationID,ObjectEntry> objects = new HashMap<>();
+        @SuppressWarnings("serial") // Conditionally serializable
         Set<ActivationID> restartSet = new HashSet<>();
 
         transient ActivationInstantiator group = null;
--- a/src/java.rmi/share/classes/sun/rmi/server/ActivationGroupImpl.java	Tue Oct 15 19:45:09 2019 +0200
+++ b/src/java.rmi/share/classes/sun/rmi/server/ActivationGroupImpl.java	Tue Oct 15 13:25:57 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -69,6 +69,7 @@
         new Hashtable<>();
     private boolean groupInactive = false;
     private final ActivationGroupID groupID;
+    @SuppressWarnings("serial")  // Conditionally serializable
     private final List<ActivationID> lockedIDs = new ArrayList<>();
 
     /**