Hi all,

Please review these small spec changes that adjust RMI specifications for the modular environment in Java 9. RMI does some reflection to handle stubs and to activate objects. The changes specify what kind of accessibility (package exports/opens, and class/method/constructor accessibility) is required for RMI to work.

Note that any existing RMI applications will end up in an unnamed module in Java 9. Since unnamed modules export and open all packages, there should be no compatibility impact.

Bugs:

        8044626: Update RMI specifications to reflect modularization changes
        https://bugs.openjdk.java.net/browse/JDK-8044626

        8165649: Re-examine if Activatable object can be created from 
non-public class
        https://bugs.openjdk.java.net/browse/JDK-8165649

Diffs below.

thanks,

s'marks



# HG changeset patch
# User smarks
# Date 1485907664 28800
#      Tue Jan 31 16:07:44 2017 -0800
# Node ID b84c67d49349b56e6c95307cd1a4c0d64c48a817
# Parent  0e0e0fbc5bf325ce0fc4d8cc2776c2038fbe6aa3
8044626: Update RMI specifications to reflect modularization changes
8165649: Re-examine if Activatable object can be created from non-public class and/or constructor
Reviewed-by: XXX

diff -r 0e0e0fbc5bf3 -r b84c67d49349 src/java.rmi/share/classes/java/rmi/activation/ActivationInstantiator.java --- a/src/java.rmi/share/classes/java/rmi/activation/ActivationInstantiator.java Fri Jan 13 12:35:53 2017 -0800 +++ b/src/java.rmi/share/classes/java/rmi/activation/ActivationInstantiator.java Tue Jan 31 16:07:44 2017 -0800
@@ -60,7 +60,19 @@
     * initialization data, and
     *
     * <li> returning a MarshalledObject containing the stub for the
-    * remote object it created </ul>
+    * remote object it created.</ul>
+    *
+ * <p>In order for activation to be successful, one of the following requirements
+    * must be met, otherwise {@link ActivationException} is thrown.
+    *
+ * <ul><li>If the class to be activated and the special activation contructor are both public,
+    * the class must reside in a package that is exported or open to the
+    * {@code java.rmi} module.
+    *
+    * <li>If either the class to be activated or the special activation 
constructor
+    * is non-public, the class must reside in a package that is open to the
+    * {@code java.rmi} module.
+    * </ul>
     *
     * @param id the object's activation identifier
     * @param desc the object's descriptor
diff -r 0e0e0fbc5bf3 -r b84c67d49349 src/java.rmi/share/classes/java/rmi/activation/Activator.java --- a/src/java.rmi/share/classes/java/rmi/activation/Activator.java Fri Jan 13 12:35:53 2017 -0800 +++ b/src/java.rmi/share/classes/java/rmi/activation/Activator.java Tue Jan 31 16:07:44 2017 -0800
@@ -48,7 +48,7 @@
  * The <code>Activator</code> works closely with
  * <code>ActivationSystem</code>, which provides a means for registering
  * groups and objects within those groups, and <code>ActivationMonitor</code>,
- * which recives information about active and inactive objects and inactive
+ * which receives information about active and inactive objects and inactive
  * groups. <p>
  *
  * The activator is responsible for monitoring and detecting when
diff -r 0e0e0fbc5bf3 -r b84c67d49349 src/java.rmi/share/classes/java/rmi/server/UnicastRemoteObject.java --- a/src/java.rmi/share/classes/java/rmi/server/UnicastRemoteObject.java Fri Jan 13 12:35:53 2017 -0800 +++ b/src/java.rmi/share/classes/java/rmi/server/UnicastRemoteObject.java Tue Jan 31 16:07:44 2017 -0800
@@ -107,8 +107,9 @@
  * the binary name of the root class with the suffix {@code _Stub}.
  *
  * <li>The stub class is loaded by name using the class loader of the root
- * class. The stub class must extend {@link RemoteStub} and must have a
- * public constructor that has one parameter of type {@link RemoteRef}.
+ * class. The stub class must be public, it must extend {@link RemoteStub}, it 
must
+ * reside in a package that is exported to the {@code java.rmi} module, and it
+ * must have a public constructor that has one parameter of type {@link 
RemoteRef}.
  *
  * <li>Finally, an instance of the stub class is constructed with a
  * {@link RemoteRef}.
@@ -124,12 +125,20 @@
  *
  * <ul>
  *
- * <li>The proxy's class is defined by the class loader of the remote
- * object's class.
+ * <li>The proxy's class is defined according to the specifications for the
+ * <a href="{@docRoot}/java/lang/reflect/Proxy.html#membership">
+ * {@code Proxy}
+ * </a>
+ * class, using the class loader of the remote object's class.
  *
  * <li>The proxy implements all the remote interfaces implemented by the
  * remote object's class.
  *
+ * <li>If all remote interfaces are public, they must reside in packages that
+ * are either exported or open to the {@code java.rmi} module. Or, if one or 
more
+ * of the remote interfaces are non-public, they must reside in a package that
+ * is open to the {@code java.rmi} module.
+ *
  * <li>The proxy's invocation handler is a {@link
  * RemoteObjectInvocationHandler} instance constructed with a
  * {@link RemoteRef}.

Reply via email to