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 |
|
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.util.Collection; |
|
38 import java.util.List; |
|
39 import java.util.Map; |
|
40 import java.util.Set; |
|
41 |
|
42 /** |
|
43 * Provides access to non-public methods in java.lang.module. |
|
44 */ |
|
45 |
|
46 public interface JavaLangModuleAccess { |
|
47 |
|
48 /** |
|
49 * Creates a builder for building a module with the given module name. |
|
50 * |
|
51 * @param strict |
|
52 * Indicates whether module names are checked or not |
|
53 */ |
|
54 ModuleDescriptor.Builder newModuleBuilder(String mn, |
|
55 boolean strict, |
|
56 Set<ModuleDescriptor.Modifier> ms); |
|
57 |
|
58 /** |
|
59 * Returns a snapshot of the packages in the module. |
|
60 */ |
|
61 Set<String> packages(ModuleDescriptor.Builder builder); |
|
62 |
|
63 /** |
|
64 * Adds a dependence on a module with the given (possibly un-parsable) |
|
65 * version string. |
|
66 */ |
|
67 void requires(ModuleDescriptor.Builder builder, |
|
68 Set<Requires.Modifier> ms, |
|
69 String mn, |
|
70 String rawCompiledVersion); |
|
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, Version v); |
|
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 */ |
|
97 Opens newOpens(Set<Opens.Modifier> ms, String source); |
|
98 |
|
99 /** |
|
100 * Returns a qualified {@code ModuleDescriptor.Opens} |
|
101 * of the given modifiers, package name source and targets. |
|
102 */ |
|
103 Opens newOpens(Set<Opens.Modifier> ms, String source, Set<String> targets); |
|
104 |
|
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 new {@code ModuleDescriptor} instance. |
|
113 */ |
|
114 ModuleDescriptor newModuleDescriptor(String name, |
|
115 Version version, |
|
116 Set<ModuleDescriptor.Modifier> ms, |
|
117 Set<Requires> requires, |
|
118 Set<Exports> exports, |
|
119 Set<Opens> opens, |
|
120 Set<String> uses, |
|
121 Set<Provides> provides, |
|
122 Set<String> packages, |
|
123 String mainClass, |
|
124 int hashCode); |
|
125 |
|
126 /** |
|
127 * Resolves a collection of root modules, with service binding |
|
128 * and the empty configuration as the parent. |
|
129 */ |
|
130 Configuration resolveAndBind(ModuleFinder finder, |
|
131 Collection<String> roots, |
|
132 PrintStream traceOutput); |
|
133 |
|
134 /** |
|
135 * Creates a configuration from a pre-generated readability graph. |
|
136 */ |
|
137 Configuration newConfiguration(ModuleFinder finder, |
|
138 Map<String, Set<String>> graph); |
|
139 |
|
140 } |
|