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: alanb, mchung
--- a/jdk/src/java.rmi/share/classes/java/rmi/activation/ActivationInstantiator.java Wed Feb 08 02:23:32 2017 +0530
+++ b/jdk/src/java.rmi/share/classes/java/rmi/activation/ActivationInstantiator.java Tue Feb 07 13:45:26 2017 -0800
@@ -60,7 +60,20 @@
* 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>The class to be activated and the special activation constructor are both public,
+ * and the class resides in a package that is
+ * {@linkplain java.lang.reflect.Module#isExported(String,java.lang.reflect.Module) exported}
+ * to at least the {@code java.rmi} module; or
+ *
+ * <li>The class to be activated resides in a package that is
+ * {@linkplain java.lang.reflect.Module#isOpen(String,java.lang.reflect.Module) open}
+ * to at least the {@code java.rmi} module.
+ * </ul>
*
* @param id the object's activation identifier
* @param desc the object's descriptor
--- a/jdk/src/java.rmi/share/classes/java/rmi/activation/Activator.java Wed Feb 08 02:23:32 2017 +0530
+++ b/jdk/src/java.rmi/share/classes/java/rmi/activation/Activator.java Tue Feb 07 13:45:26 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
--- a/jdk/src/java.rmi/share/classes/java/rmi/server/UnicastRemoteObject.java Wed Feb 08 02:23:32 2017 +0530
+++ b/jdk/src/java.rmi/share/classes/java/rmi/server/UnicastRemoteObject.java Tue Feb 07 13:45:26 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 at least 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,21 @@
*
* <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>Each remote interface must either be public and reside in a package that is
+ * {@linkplain java.lang.reflect.Module#isExported(String,java.lang.reflect.Module) exported}
+ * to at least the {@code java.rmi} module, or it must reside in a package that is
+ * {@linkplain java.lang.reflect.Module#isOpen(String,java.lang.reflect.Module) open}
+ * to at least the {@code java.rmi} module.
+ *
* <li>The proxy's invocation handler is a {@link
* RemoteObjectInvocationHandler} instance constructed with a
* {@link RemoteRef}.