21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package jdk.internal.misc; 27 28 import java.io.PrintStream; 29 import java.lang.module.Configuration; 30 import java.lang.module.ModuleDescriptor; 31 import java.lang.module.ModuleDescriptor.Exports; 32 import java.lang.module.ModuleDescriptor.Opens; 33 import java.lang.module.ModuleDescriptor.Requires; 34 import java.lang.module.ModuleDescriptor.Provides; 35 import java.lang.module.ModuleDescriptor.Version; 36 import java.lang.module.ModuleFinder; 37 import java.lang.module.ModuleReader; 38 import java.lang.module.ModuleReference; 39 import java.net.URI; 40 import java.nio.file.Path; 41 import java.util.Map; 42 import java.util.Collection; 43 import java.util.List; 44 import java.util.Optional; 45 import java.util.Set; 46 import java.util.function.Supplier; 47 48 import jdk.internal.module.ModuleHashes; 49 50 /** 51 * Provides access to non-public methods in java.lang.module. 52 */ 53 54 public interface JavaLangModuleAccess { 55 56 /** 57 * Creates a builder for building a module with the given module name. 58 * 59 * @param strict 60 * Indicates whether module names are checked or not 61 */ 62 ModuleDescriptor.Builder newModuleBuilder(String mn, boolean strict); 63 64 /** 65 * Creates a builder for building an open module with the given module name. 66 * 67 * @param strict 68 * Indicates whether module names are checked or not 69 */ 70 ModuleDescriptor.Builder newOpenModuleBuilder(String mn, boolean strict); 71 72 /** 73 * Returns a {@code ModuleDescriptor.Requires} of the given modifiers 74 * and module name. 75 */ 76 Requires newRequires(Set<Requires.Modifier> ms, String mn); 77 78 /** 79 * Returns an unqualified {@code ModuleDescriptor.Exports} 80 * of the given modifiers and package name source. 81 */ 82 Exports newExports(Set<Exports.Modifier> ms, 83 String source); 84 85 /** 86 * Returns a qualified {@code ModuleDescriptor.Exports} 87 * of the given modifiers, package name source and targets. 88 */ 89 Exports newExports(Set<Exports.Modifier> ms, 90 String source, 91 Set<String> targets); 92 93 /** 94 * Returns an unqualified {@code ModuleDescriptor.Opens} 95 * of the given modifiers and package name source. 96 */ 105 /** 106 * Returns a {@code ModuleDescriptor.Provides} 107 * of the given service name and providers. 108 */ 109 Provides newProvides(String service, List<String> providers); 110 111 /** 112 * Returns a {@code ModuleDescriptor.Version} of the given version. 113 */ 114 Version newVersion(String v); 115 116 /** 117 * Clones the given module descriptor with an augmented set of packages 118 */ 119 ModuleDescriptor newModuleDescriptor(ModuleDescriptor md, Set<String> pkgs); 120 121 /** 122 * Returns a new {@code ModuleDescriptor} instance. 123 */ 124 ModuleDescriptor newModuleDescriptor(String name, 125 boolean open, 126 boolean automatic, 127 boolean synthetic, 128 Set<Requires> requires, 129 Set<Exports> exports, 130 Set<Opens> opens, 131 Set<String> uses, 132 Set<Provides> provides, 133 Version version, 134 String mainClass, 135 String osName, 136 String osArch, 137 String osVersion, 138 Set<String> packages, 139 ModuleHashes hashes, 140 int hashCode); 141 142 /** 143 * Returns the object with the hashes of other modules 144 */ 145 Optional<ModuleHashes> hashes(ModuleDescriptor descriptor); 146 147 /** 148 * Resolves a collection of root modules, with service binding 149 * and the empty configuration as the parent. The post resolution 150 * checks are optionally run. 151 */ 152 Configuration resolveRequiresAndUses(ModuleFinder finder, 153 Collection<String> roots, 154 boolean check, 155 PrintStream traceOutput); 156 157 /** 158 * Creates a ModuleReference to a "patched" module. 159 */ 160 ModuleReference newPatchedModule(ModuleDescriptor descriptor, 161 URI location, 162 Supplier<ModuleReader> readerSupplier); 163 164 /** 165 * Creates a ModuleFinder for a module path. 166 */ 167 ModuleFinder newModulePath(Runtime.Version version, 168 boolean isLinkPhase, 169 Path... entries); 170 171 } | 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 22 * or visit www.oracle.com if you need additional information or have any 23 * questions. 24 */ 25 26 package jdk.internal.misc; 27 28 import java.io.PrintStream; 29 import java.lang.module.Configuration; 30 import java.lang.module.ModuleDescriptor; 31 import java.lang.module.ModuleDescriptor.Exports; 32 import java.lang.module.ModuleDescriptor.Opens; 33 import java.lang.module.ModuleDescriptor.Requires; 34 import java.lang.module.ModuleDescriptor.Provides; 35 import java.lang.module.ModuleDescriptor.Version; 36 import java.lang.module.ModuleFinder; 37 import java.lang.module.ModuleReader; 38 import java.lang.module.ModuleReference; 39 import java.net.URI; 40 import java.nio.file.Path; 41 import java.util.Collection; 42 import java.util.List; 43 import java.util.Set; 44 import java.util.function.Supplier; 45 46 import jdk.internal.module.ModuleHashes; 47 48 /** 49 * Provides access to non-public methods in java.lang.module. 50 */ 51 52 public interface JavaLangModuleAccess { 53 54 /** 55 * Creates a builder for building a module with the given module name. 56 * 57 * @param strict 58 * Indicates whether module names are checked or not 59 */ 60 ModuleDescriptor.Builder newModuleBuilder(String mn, 61 boolean strict, 62 boolean open, 63 boolean synthetic); 64 65 /** 66 * Returns the set of packages that are exported (unconditionally or 67 * unconditionally). 68 */ 69 Set<String> exportedPackages(ModuleDescriptor.Builder builder); 70 71 /** 72 * Returns the set of packages that are opened (unconditionally or 73 * unconditionally). 74 */ 75 Set<String> openPackages(ModuleDescriptor.Builder builder); 76 77 /** 78 * Returns a {@code ModuleDescriptor.Requires} of the given modifiers 79 * and module name. 80 */ 81 Requires newRequires(Set<Requires.Modifier> ms, String mn, Version v); 82 83 /** 84 * Returns an unqualified {@code ModuleDescriptor.Exports} 85 * of the given modifiers and package name source. 86 */ 87 Exports newExports(Set<Exports.Modifier> ms, 88 String source); 89 90 /** 91 * Returns a qualified {@code ModuleDescriptor.Exports} 92 * of the given modifiers, package name source and targets. 93 */ 94 Exports newExports(Set<Exports.Modifier> ms, 95 String source, 96 Set<String> targets); 97 98 /** 99 * Returns an unqualified {@code ModuleDescriptor.Opens} 100 * of the given modifiers and package name source. 101 */ 110 /** 111 * Returns a {@code ModuleDescriptor.Provides} 112 * of the given service name and providers. 113 */ 114 Provides newProvides(String service, List<String> providers); 115 116 /** 117 * Returns a {@code ModuleDescriptor.Version} of the given version. 118 */ 119 Version newVersion(String v); 120 121 /** 122 * Clones the given module descriptor with an augmented set of packages 123 */ 124 ModuleDescriptor newModuleDescriptor(ModuleDescriptor md, Set<String> pkgs); 125 126 /** 127 * Returns a new {@code ModuleDescriptor} instance. 128 */ 129 ModuleDescriptor newModuleDescriptor(String name, 130 Version version, 131 boolean open, 132 boolean automatic, 133 boolean synthetic, 134 Set<Requires> requires, 135 Set<Exports> exports, 136 Set<Opens> opens, 137 Set<String> uses, 138 Set<Provides> provides, 139 Set<String> packages, 140 String mainClass, 141 String osName, 142 String osArch, 143 String osVersion, 144 int hashCode); 145 146 /** 147 * Resolves a collection of root modules, with service binding 148 * and the empty configuration as the parent. The post resolution 149 * checks are optionally run. 150 */ 151 Configuration resolveRequiresAndUses(ModuleFinder finder, 152 Collection<String> roots, 153 boolean check, 154 PrintStream traceOutput); 155 156 } |