< prev index next >

src/java.base/share/classes/java/lang/ClassLoader.java

Print this page
@@ -56,10 +56,11 @@
  import jdk.internal.loader.BuiltinClassLoader;
  import jdk.internal.loader.ClassLoaders;
  import jdk.internal.loader.NativeLibrary;
  import jdk.internal.loader.NativeLibraries;
  import jdk.internal.perf.PerfCounter;
+ import jdk.internal.misc.CDS;
  import jdk.internal.misc.Unsafe;
  import jdk.internal.misc.VM;
  import jdk.internal.reflect.CallerSensitive;
  import jdk.internal.reflect.CallerSensitiveAdapter;
  import jdk.internal.reflect.Reflection;

@@ -2567,12 +2568,25 @@
       */
      private void resetArchivedStates() {
          if (parallelLockMap != null) {
              parallelLockMap.clear();
          }
-         packages.clear();
-         package2certs.clear();
+ 
+         if (CDS.isDumpingPackages()) {
+             if (System.getProperty("cds.debug.archived.packages") != null) {
+                 for (Map.Entry<String, NamedPackage> entry : packages.entrySet()) {
+                     String key = entry.getKey();
+                     NamedPackage value = entry.getValue();
+                     System.out.println("Archiving " + 
+                                        (value instanceof Package ? "Package" : "NamedPackage") +
+                                        " \"" + key + "\" for " + this);
+                 }
+             }
+         } else {
+             packages.clear();
+             package2certs.clear();
+         }
          classes.clear();
          classLoaderValueMap = null;
      }
  }
  
< prev index next >