1 /*
2 * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
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
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,
97
98 /**
99 * Returns an unqualified {@code ModuleDescriptor.Opens}
100 * of the given modifiers and package name source.
101 */
102 Opens newOpens(Set<Opens.Modifier> ms, String source);
103
104 /**
105 * Returns a qualified {@code ModuleDescriptor.Opens}
106 * of the given modifiers, package name source and targets.
107 */
108 Opens newOpens(Set<Opens.Modifier> ms, String source, Set<String> targets);
109
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 }
|
1 /*
2 * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
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
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 Set<ModuleDescriptor.Modifier> ms);
63
64 /**
65 * Returns a snapshot of the packages in the module.
66 */
67 Set<String> packages(ModuleDescriptor.Builder builder);
68
69 /**
70 * Adds a dependence on a module with the given (possibly un-parsable)
71 * version string.
72 */
73 void requires(ModuleDescriptor.Builder builder,
74 Set<Requires.Modifier> ms,
75 String mn,
76 String compiledVersion);
77
78 /**
79 * Returns a {@code ModuleDescriptor.Requires} of the given modifiers
80 * and module name.
81 */
82 Requires newRequires(Set<Requires.Modifier> ms, String mn, Version v);
83
84 /**
85 * Returns an unqualified {@code ModuleDescriptor.Exports}
86 * of the given modifiers and package name source.
87 */
88 Exports newExports(Set<Exports.Modifier> ms,
89 String source);
90
91 /**
92 * Returns a qualified {@code ModuleDescriptor.Exports}
93 * of the given modifiers, package name source and targets.
94 */
95 Exports newExports(Set<Exports.Modifier> ms,
96 String source,
98
99 /**
100 * Returns an unqualified {@code ModuleDescriptor.Opens}
101 * of the given modifiers and package name source.
102 */
103 Opens newOpens(Set<Opens.Modifier> ms, String source);
104
105 /**
106 * Returns a qualified {@code ModuleDescriptor.Opens}
107 * of the given modifiers, package name source and targets.
108 */
109 Opens newOpens(Set<Opens.Modifier> ms, String source, Set<String> targets);
110
111 /**
112 * Returns a {@code ModuleDescriptor.Provides}
113 * of the given service name and providers.
114 */
115 Provides newProvides(String service, List<String> providers);
116
117 /**
118 * Returns a new {@code ModuleDescriptor} instance.
119 */
120 ModuleDescriptor newModuleDescriptor(String name,
121 Version version,
122 Set<ModuleDescriptor.Modifier> ms,
123 Set<Requires> requires,
124 Set<Exports> exports,
125 Set<Opens> opens,
126 Set<String> uses,
127 Set<Provides> provides,
128 Set<String> packages,
129 String mainClass,
130 String osName,
131 String osArch,
132 String osVersion,
133 int hashCode);
134
135 /**
136 * Resolves a collection of root modules, with service binding
137 * and the empty configuration as the parent. The post resolution
138 * checks are optionally run.
139 */
140 Configuration resolveAndBind(ModuleFinder finder,
141 Collection<String> roots,
142 boolean check,
143 PrintStream traceOutput);
144
145 }
|