RFR(s): 8044626 & 8165649 RMI spec changes for modularization
Stuart Marks
stuart.marks at oracle.com
Wed Feb 1 20:47:22 UTC 2017
On 2/1/17 12:33 AM, Alan Bateman wrote:
> On 01/02/2017 00:22, Stuart Marks wrote:
>> + *
>> + * <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.
> I think it would be better to just say "exported" rather than "exported or open"
> and have it link to Module#isExported(String,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>
> and for completeness, have "open" link to Module#isOpen(String,Module).
I think the "open" in the first item is necessary, given that the second item
restricts itself to the non-public cases. However, the latter restriction isn't
necessary! I wrote out all 16 cases in a truth table (open, exported, pub-class,
pub-constructor) and minimized it -- though not using a Karnaugh map -- and the
result is simply:
(exported && public-class && public-constructor) || open
This simplifies things somewhat.
The situation with dynamic stubs in UnicastRemoteObject is similar. The logic is
the same, but there can be a mixture of remote interfaces, which complicates
things a bit. Nonetheless I think the rewording came well.
I've also added links per your suggestion, and fixed some typos.
Revised diff below.
s'marks
diff -r 0e0e0fbc5bf3
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
Wed Feb 01 12:44:24 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 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 the {@code java.rmi} module.
+ * </ul>
*
* @param id the object's activation identifier
* @param desc the object's descriptor
diff -r 0e0e0fbc5bf3 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 Wed Feb 01
12:44:24 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
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 Wed
Feb 01 12:44:24 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,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 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 the {@code java.rmi} module.
+ *
* <li>The proxy's invocation handler is a {@link
* RemoteObjectInvocationHandler} instance constructed with a
* {@link RemoteRef}.
More information about the core-libs-dev
mailing list