48 /**
49 * A helper class for creating and updating modules. This class is intended to
50 * support command-line options, tests, and the instrumentation API. It is also
51 * used by the VM to load modules or add read edges when agents are instrumenting
52 * code that need to link to supporting classes.
53 *
54 * The parameters that are package names in this API are the fully-qualified
55 * names of the packages as defined in section 6.5.3 of <cite>The Java™
56 * Language Specification </cite>, for example, {@code "java.lang"}.
57 */
58
59 public class Modules {
60 private Modules() { }
61
62 private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess();
63
64 /**
65 * Creates a new Module. The module has the given ModuleDescriptor and
66 * is defined to the given class loader.
67 *
68 * The resulting Module is in a larval state in that it does not not read
69 * any other module and does not have any exports.
70 *
71 * The URI is for information purposes only.
72 */
73 public static Module defineModule(ClassLoader loader,
74 ModuleDescriptor descriptor,
75 URI uri)
76 {
77 return JLA.defineModule(loader, descriptor, uri);
78 }
79
80 /**
81 * Updates m1 to read m2.
82 * Same as m1.addReads(m2) but without a caller check.
83 */
84 public static void addReads(Module m1, Module m2) {
85 JLA.addReads(m1, m2);
86 }
87
88 /**
|
48 /**
49 * A helper class for creating and updating modules. This class is intended to
50 * support command-line options, tests, and the instrumentation API. It is also
51 * used by the VM to load modules or add read edges when agents are instrumenting
52 * code that need to link to supporting classes.
53 *
54 * The parameters that are package names in this API are the fully-qualified
55 * names of the packages as defined in section 6.5.3 of <cite>The Java™
56 * Language Specification </cite>, for example, {@code "java.lang"}.
57 */
58
59 public class Modules {
60 private Modules() { }
61
62 private static final JavaLangAccess JLA = SharedSecrets.getJavaLangAccess();
63
64 /**
65 * Creates a new Module. The module has the given ModuleDescriptor and
66 * is defined to the given class loader.
67 *
68 * The resulting Module is in a larval state in that it does not read
69 * any other module and does not have any exports.
70 *
71 * The URI is for information purposes only.
72 */
73 public static Module defineModule(ClassLoader loader,
74 ModuleDescriptor descriptor,
75 URI uri)
76 {
77 return JLA.defineModule(loader, descriptor, uri);
78 }
79
80 /**
81 * Updates m1 to read m2.
82 * Same as m1.addReads(m2) but without a caller check.
83 */
84 public static void addReads(Module m1, Module m2) {
85 JLA.addReads(m1, m2);
86 }
87
88 /**
|