changeset 13543:c7eb744c853a

Add reads and exports in preparation for changing setAccessible
author alanb
date Wed, 29 Jul 2015 17:27:58 +0100
parents 5cf67b8de07c
children 01989b3e4652
files src/java.instrument/share/classes/sun/instrument/InstrumentationImpl.java src/java.management/share/classes/sun/management/MappedMXBeanType.java src/java.rmi/share/classes/sun/rmi/server/ActivationGroupImpl.java src/java.rmi/share/classes/sun/rmi/server/UnicastServerRef.java src/jdk.jvmstat/share/classes/module-info.java
diffstat 5 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.instrument/share/classes/sun/instrument/InstrumentationImpl.java	Wed Jul 29 14:21:34 2015 +0100
+++ b/src/java.instrument/share/classes/sun/instrument/InstrumentationImpl.java	Wed Jul 29 17:27:58 2015 +0100
@@ -375,6 +375,8 @@
             }
         }
 
+        this.getClass().getModule().addReads(javaAgentClass.getModule());
+
         // the premain method should not be required to be public,
         // make it accessible so we can call it
         // Note: The spec says the following:
@@ -387,9 +389,6 @@
         } else {
             m.invoke(null, new Object[] { optionsString });
         }
-
-        // don't let others access a non-public premain method
-        setAccessible(m, false);
     }
 
     // WARNING: the native code knows the name & signature of this method
--- a/src/java.management/share/classes/sun/management/MappedMXBeanType.java	Wed Jul 29 14:21:34 2015 +0100
+++ b/src/java.management/share/classes/sun/management/MappedMXBeanType.java	Wed Jul 29 17:27:58 2015 +0100
@@ -633,6 +633,7 @@
                         if (m != null
                                 && CompositeData.class.isAssignableFrom(m.getReturnType())
                                 && Modifier.isStatic(m.getModifiers())) {
+                            this.getClass().getModule().addReads(javaClass.getModule());
                             m.setAccessible(true);
                             return m;
                         } else {
--- a/src/java.rmi/share/classes/sun/rmi/server/ActivationGroupImpl.java	Wed Jul 29 14:21:34 2015 +0100
+++ b/src/java.rmi/share/classes/sun/rmi/server/ActivationGroupImpl.java	Wed Jul 29 17:27:58 2015 +0100
@@ -257,6 +257,7 @@
                           Constructor<? extends Remote> constructor =
                               cl.getDeclaredConstructor(
                                   ActivationID.class, MarshalledObject.class);
+                          this.getClass().getModule().addReads(cl.getModule());
                           constructor.setAccessible(true);
                           try {
                               /*
--- a/src/java.rmi/share/classes/sun/rmi/server/UnicastServerRef.java	Wed Jul 29 14:21:34 2015 +0100
+++ b/src/java.rmi/share/classes/sun/rmi/server/UnicastServerRef.java	Wed Jul 29 17:27:58 2015 +0100
@@ -553,6 +553,8 @@
                             AccessController.doPrivileged(
                                 new PrivilegedAction<Void>() {
                                 public Void run() {
+                                    this.getClass().getModule()
+                                        .addReads(m.getDeclaringClass().getModule());
                                     m.setAccessible(true);
                                     return null;
                                 }
--- a/src/jdk.jvmstat/share/classes/module-info.java	Wed Jul 29 14:21:34 2015 +0100
+++ b/src/jdk.jvmstat/share/classes/module-info.java	Wed Jul 29 17:27:58 2015 +0100
@@ -32,6 +32,10 @@
         jdk.jconsole;
     exports sun.jvmstat.monitor.event to
         jdk.jcmd;
+
+    // RMI needs to serialize types in this package
+    exports sun.jvmstat.monitor.remote to java.rmi;
+
     uses sun.jvmstat.monitor.MonitoredHostService;
     provides sun.jvmstat.monitor.MonitoredHostService with sun.jvmstat.perfdata.monitor.protocol.file.MonitoredHostFileService;
     provides sun.jvmstat.monitor.MonitoredHostService with sun.jvmstat.perfdata.monitor.protocol.local.MonitoredHostLocalService;