changeset 19231:76dd36f621f4

Further cleanup of --permit-illegal-access
author alanb
date Thu, 09 Mar 2017 09:31:39 +0000
parents a6810e79e9fd
children 84c73f4fe2d1
files src/java.base/share/classes/jdk/internal/module/IllegalAccessLogger.java src/java.base/share/classes/sun/launcher/resources/launcher.properties
diffstat 2 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/java.base/share/classes/jdk/internal/module/IllegalAccessLogger.java	Wed Mar 08 18:25:17 2017 +0000
+++ b/src/java.base/share/classes/jdk/internal/module/IllegalAccessLogger.java	Thu Mar 09 09:31:39 2017 +0000
@@ -64,8 +64,8 @@
     // lock to avoid interference when printing stack traces
     private static final Object OUTPUT_LOCK = new Object();
 
-    // target class -> usage/access site
-    private final Map<Class<?>, Set<Usage>> targetToUsage = new WeakHashMap<>();
+    // caller -> usages
+    private final Map<Class<?>, Set<Usage>> callerToUsages = new WeakHashMap<>();
 
     // module -> (package name -> CLI option)
     private final Map<Module, Map<String, String>> exported;
@@ -126,7 +126,7 @@
      * To reduce output, this method only logs the access if it hasn't been seen
      * previously. "Seen previously" is implemented as a map of caller class -> Usage,
      * where a Usage is the "what" and a hash of the stack trace. The map has weak
-     * keys so it can be expunged when the caller class is GC'ed/unloaded.
+     * keys so it can be expunged when the target class is GC'ed/unloaded.
      */
     private void log(Class<?> caller, Class<?> target, String what, String how) {
         // stack trace without the top-most frames in java.base
@@ -140,7 +140,7 @@
         Usage u = new Usage(what, hash(stack));
         boolean firstUsage;
         synchronized (this) {
-            firstUsage = targetToUsage.computeIfAbsent(target, k -> new HashSet<>()).add(u);
+            firstUsage = callerToUsages.computeIfAbsent(caller, k -> new HashSet<>()).add(u);
         }
 
         // log message if first usage
--- a/src/java.base/share/classes/sun/launcher/resources/launcher.properties	Wed Mar 08 18:25:17 2017 +0000
+++ b/src/java.base/share/classes/sun/launcher/resources/launcher.properties	Thu Mar 09 09:31:39 2017 +0000
@@ -157,9 +157,10 @@
 \    --add-opens <module>/<package>=<target-module>(,<target-module>)*\n\
 \                      updates <module> to open <package> to\n\
 \                      <target-module>, regardless of module declaration.\n\
-\    --force-open-all-module-packages\n\
-\                      force all modules to open all packages, regardless of\n\
-\                      module declarations.\n\
+\    --permit-illegal-access\n\
+\                      permit illegal access to members of types in named modules\n\
+\                      by code in unnamed modules. This compatibility option will\n\
+\                      be removed in the next release.\n\
 \    --disable-@files  disable further argument file expansion\n\
 \    --patch-module <module>=<file>({0}<file>)*\n\
 \                      Override or augment a module with classes and resources\n\