< prev index next >

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

Print this page

*** 53,62 **** --- 53,63 ---- import java.util.stream.Stream; import jdk.internal.loader.BuiltinClassLoader; import jdk.internal.loader.BootLoader; import jdk.internal.loader.ClassLoaders; + import jdk.internal.misc.VM; import jdk.internal.module.IllegalAccessLogger; import jdk.internal.module.ModuleLoaderMap; import jdk.internal.module.ServicesCatalog; import jdk.internal.module.Resources; import jdk.internal.org.objectweb.asm.AnnotationVisitor;
*** 244,259 **** } // -- // special Module to mean "all unnamed modules" ! private static final Module ALL_UNNAMED_MODULE = new Module(null); ! private static final Set<Module> ALL_UNNAMED_MODULE_SET = Set.of(ALL_UNNAMED_MODULE); // special Module to mean "everyone" ! private static final Module EVERYONE_MODULE = new Module(null); ! private static final Set<Module> EVERYONE_SET = Set.of(EVERYONE_MODULE); /** * The holder of data structures to support readability, exports, and * service use added at runtime with the reflective APIs. */ --- 245,311 ---- } // -- // special Module to mean "all unnamed modules" ! private static final Module ALL_UNNAMED_MODULE; ! private static final Set<Module> ALL_UNNAMED_MODULE_SET; // special Module to mean "everyone" ! private static final Module EVERYONE_MODULE; ! private static final Set<Module> EVERYONE_SET; ! ! private static class ArchivedData { ! private static ArchivedData singleton; ! ! private final Module ALL_UNNAMED_MODULE; ! private final Set<Module> ALL_UNNAMED_MODULE_SET; ! private final Module EVERYONE_MODULE; ! private final Set<Module> EVERYONE_SET; ! ! public ArchivedData(Module ALL_UNNAMED_MODULE, ! Set<Module> ALL_UNNAMED_MODULE_SET, ! Module EVERYONE_MODULE, ! Set<Module> EVERYONE_SET) { ! this.ALL_UNNAMED_MODULE = ALL_UNNAMED_MODULE; ! this.ALL_UNNAMED_MODULE_SET = ALL_UNNAMED_MODULE_SET; ! this.EVERYONE_MODULE = EVERYONE_MODULE; ! this.EVERYONE_SET = EVERYONE_SET; ! } ! ! static void archive(ArchivedData archivedData) { ! singleton = archivedData; ! } ! ! static ArchivedData get() { ! return singleton; ! } ! ! static { ! VM.initializeFromArchive(ArchivedData.class); ! } ! } ! ! static { ! ArchivedData archivedData = ArchivedData.get(); ! if (archivedData != null) { ! ALL_UNNAMED_MODULE = archivedData.ALL_UNNAMED_MODULE; ! ALL_UNNAMED_MODULE_SET = archivedData.ALL_UNNAMED_MODULE_SET; ! EVERYONE_MODULE = archivedData.EVERYONE_MODULE; ! EVERYONE_SET = archivedData.EVERYONE_SET; ! } else { ! ALL_UNNAMED_MODULE = new Module(null); ! ALL_UNNAMED_MODULE_SET = Set.of(ALL_UNNAMED_MODULE); ! EVERYONE_MODULE = new Module(null); ! EVERYONE_SET = Set.of(EVERYONE_MODULE); ! ! ArchivedData.archive(new ArchivedData(ALL_UNNAMED_MODULE, ! ALL_UNNAMED_MODULE_SET, ! EVERYONE_MODULE, ! EVERYONE_SET)); ! } ! } /** * The holder of data structures to support readability, exports, and * service use added at runtime with the reflective APIs. */
< prev index next >