author | mchung |
Tue, 06 Nov 2018 10:01:16 -0800 | |
changeset 52427 | 3c6aa484536c |
parent 47216 | src/java.base/share/classes/jdk/internal/misc/JavaLangModuleAccess.java@71c04702a3d5 |
permissions | -rw-r--r-- |
36511 | 1 |
/* |
52427
3c6aa484536c
8211122: Reduce the number of internal classes made accessible to jdk.unsupported
mchung
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. |
36511 | 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 |
||
52427
3c6aa484536c
8211122: Reduce the number of internal classes made accessible to jdk.unsupported
mchung
parents:
47216
diff
changeset
|
26 |
package jdk.internal.access; |
36511 | 27 |
|
37779
7c84df693837
8154956: Module system implementation refresh (4/2016)
alanb
parents:
36511
diff
changeset
|
28 |
import java.io.PrintStream; |
7c84df693837
8154956: Module system implementation refresh (4/2016)
alanb
parents:
36511
diff
changeset
|
29 |
import java.lang.module.Configuration; |
36511 | 30 |
import java.lang.module.ModuleDescriptor; |
31 |
import java.lang.module.ModuleDescriptor.Exports; |
|
42338
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
32 |
import java.lang.module.ModuleDescriptor.Opens; |
36511 | 33 |
import java.lang.module.ModuleDescriptor.Requires; |
34 |
import java.lang.module.ModuleDescriptor.Provides; |
|
35 |
import java.lang.module.ModuleDescriptor.Version; |
|
37779
7c84df693837
8154956: Module system implementation refresh (4/2016)
alanb
parents:
36511
diff
changeset
|
36 |
import java.lang.module.ModuleFinder; |
42338
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
37 |
import java.util.Collection; |
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
38 |
import java.util.List; |
46096
62c77b334012
8185853: Generate readability graph at link time and other startup improvements
alanb
parents:
44359
diff
changeset
|
39 |
import java.util.Map; |
36511 | 40 |
import java.util.Set; |
42338
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
41 |
|
36511 | 42 |
/** |
43 |
* Provides access to non-public methods in java.lang.module. |
|
44 |
*/ |
|
45 |
||
46 |
public interface JavaLangModuleAccess { |
|
47 |
||
48 |
/** |
|
42338
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
49 |
* Creates a builder for building a module with the given module name. |
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
50 |
* |
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
51 |
* @param strict |
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
52 |
* Indicates whether module names are checked or not |
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
53 |
*/ |
42703
20c39ea4a507
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42338
diff
changeset
|
54 |
ModuleDescriptor.Builder newModuleBuilder(String mn, |
20c39ea4a507
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42338
diff
changeset
|
55 |
boolean strict, |
43712
5dfd0950317c
8173393: Module system implementation refresh (2/2017)
alanb
parents:
42703
diff
changeset
|
56 |
Set<ModuleDescriptor.Modifier> ms); |
5dfd0950317c
8173393: Module system implementation refresh (2/2017)
alanb
parents:
42703
diff
changeset
|
57 |
|
5dfd0950317c
8173393: Module system implementation refresh (2/2017)
alanb
parents:
42703
diff
changeset
|
58 |
/** |
5dfd0950317c
8173393: Module system implementation refresh (2/2017)
alanb
parents:
42703
diff
changeset
|
59 |
* Returns a snapshot of the packages in the module. |
5dfd0950317c
8173393: Module system implementation refresh (2/2017)
alanb
parents:
42703
diff
changeset
|
60 |
*/ |
5dfd0950317c
8173393: Module system implementation refresh (2/2017)
alanb
parents:
42703
diff
changeset
|
61 |
Set<String> packages(ModuleDescriptor.Builder builder); |
42338
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
62 |
|
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
63 |
/** |
43712
5dfd0950317c
8173393: Module system implementation refresh (2/2017)
alanb
parents:
42703
diff
changeset
|
64 |
* Adds a dependence on a module with the given (possibly un-parsable) |
5dfd0950317c
8173393: Module system implementation refresh (2/2017)
alanb
parents:
42703
diff
changeset
|
65 |
* version string. |
42338
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
66 |
*/ |
43712
5dfd0950317c
8173393: Module system implementation refresh (2/2017)
alanb
parents:
42703
diff
changeset
|
67 |
void requires(ModuleDescriptor.Builder builder, |
5dfd0950317c
8173393: Module system implementation refresh (2/2017)
alanb
parents:
42703
diff
changeset
|
68 |
Set<Requires.Modifier> ms, |
5dfd0950317c
8173393: Module system implementation refresh (2/2017)
alanb
parents:
42703
diff
changeset
|
69 |
String mn, |
44359
c6761862ca0b
8174823: Module system implementation refresh (3/2017)
alanb
parents:
43712
diff
changeset
|
70 |
String rawCompiledVersion); |
42338
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
71 |
|
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
72 |
/** |
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
73 |
* Returns a {@code ModuleDescriptor.Requires} of the given modifiers |
36511 | 74 |
* and module name. |
75 |
*/ |
|
42703
20c39ea4a507
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42338
diff
changeset
|
76 |
Requires newRequires(Set<Requires.Modifier> ms, String mn, Version v); |
36511 | 77 |
|
78 |
/** |
|
79 |
* Returns an unqualified {@code ModuleDescriptor.Exports} |
|
42338
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
80 |
* of the given modifiers and package name source. |
36511 | 81 |
*/ |
42338
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
82 |
Exports newExports(Set<Exports.Modifier> ms, |
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
83 |
String source); |
36511 | 84 |
|
85 |
/** |
|
86 |
* Returns a qualified {@code ModuleDescriptor.Exports} |
|
42338
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
87 |
* of the given modifiers, package name source and targets. |
36511 | 88 |
*/ |
42338
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
89 |
Exports newExports(Set<Exports.Modifier> ms, |
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
90 |
String source, |
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
91 |
Set<String> targets); |
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
92 |
|
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
93 |
/** |
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
94 |
* Returns an unqualified {@code ModuleDescriptor.Opens} |
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
95 |
* of the given modifiers and package name source. |
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
96 |
*/ |
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
97 |
Opens newOpens(Set<Opens.Modifier> ms, String source); |
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
98 |
|
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
99 |
/** |
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
100 |
* Returns a qualified {@code ModuleDescriptor.Opens} |
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
101 |
* of the given modifiers, package name source and targets. |
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
102 |
*/ |
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
103 |
Opens newOpens(Set<Opens.Modifier> ms, String source, Set<String> targets); |
36511 | 104 |
|
105 |
/** |
|
106 |
* Returns a {@code ModuleDescriptor.Provides} |
|
107 |
* of the given service name and providers. |
|
108 |
*/ |
|
42338
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
109 |
Provides newProvides(String service, List<String> providers); |
36511 | 110 |
|
111 |
/** |
|
112 |
* Returns a new {@code ModuleDescriptor} instance. |
|
113 |
*/ |
|
114 |
ModuleDescriptor newModuleDescriptor(String name, |
|
42703
20c39ea4a507
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42338
diff
changeset
|
115 |
Version version, |
43712
5dfd0950317c
8173393: Module system implementation refresh (2/2017)
alanb
parents:
42703
diff
changeset
|
116 |
Set<ModuleDescriptor.Modifier> ms, |
36511 | 117 |
Set<Requires> requires, |
42338
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
118 |
Set<Exports> exports, |
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
119 |
Set<Opens> opens, |
36511 | 120 |
Set<String> uses, |
42338
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
121 |
Set<Provides> provides, |
42703
20c39ea4a507
8170987: Module system implementation refresh (12/2016)
alanb
parents:
42338
diff
changeset
|
122 |
Set<String> packages, |
36511 | 123 |
String mainClass, |
42338
a60f280f803c
8169069: Module system implementation refresh (11/2016)
alanb
parents:
41817
diff
changeset
|
124 |
int hashCode); |
37779
7c84df693837
8154956: Module system implementation refresh (4/2016)
alanb
parents:
36511
diff
changeset
|
125 |
|
7c84df693837
8154956: Module system implementation refresh (4/2016)
alanb
parents:
36511
diff
changeset
|
126 |
/** |
7c84df693837
8154956: Module system implementation refresh (4/2016)
alanb
parents:
36511
diff
changeset
|
127 |
* Resolves a collection of root modules, with service binding |
46096
62c77b334012
8185853: Generate readability graph at link time and other startup improvements
alanb
parents:
44359
diff
changeset
|
128 |
* and the empty configuration as the parent. |
37779
7c84df693837
8154956: Module system implementation refresh (4/2016)
alanb
parents:
36511
diff
changeset
|
129 |
*/ |
43712
5dfd0950317c
8173393: Module system implementation refresh (2/2017)
alanb
parents:
42703
diff
changeset
|
130 |
Configuration resolveAndBind(ModuleFinder finder, |
5dfd0950317c
8173393: Module system implementation refresh (2/2017)
alanb
parents:
42703
diff
changeset
|
131 |
Collection<String> roots, |
5dfd0950317c
8173393: Module system implementation refresh (2/2017)
alanb
parents:
42703
diff
changeset
|
132 |
PrintStream traceOutput); |
37779
7c84df693837
8154956: Module system implementation refresh (4/2016)
alanb
parents:
36511
diff
changeset
|
133 |
|
46096
62c77b334012
8185853: Generate readability graph at link time and other startup improvements
alanb
parents:
44359
diff
changeset
|
134 |
/** |
62c77b334012
8185853: Generate readability graph at link time and other startup improvements
alanb
parents:
44359
diff
changeset
|
135 |
* Creates a configuration from a pre-generated readability graph. |
62c77b334012
8185853: Generate readability graph at link time and other startup improvements
alanb
parents:
44359
diff
changeset
|
136 |
*/ |
62c77b334012
8185853: Generate readability graph at link time and other startup improvements
alanb
parents:
44359
diff
changeset
|
137 |
Configuration newConfiguration(ModuleFinder finder, |
62c77b334012
8185853: Generate readability graph at link time and other startup improvements
alanb
parents:
44359
diff
changeset
|
138 |
Map<String, Set<String>> graph); |
62c77b334012
8185853: Generate readability graph at link time and other startup improvements
alanb
parents:
44359
diff
changeset
|
139 |
|
36511 | 140 |
} |