author | alanb |
Fri, 28 Oct 2016 10:18:07 +0100 | |
changeset 41817 | b90ad1de93ea |
parent 41555 | 8a2a5a88376a |
child 42338 | a60f280f803c |
permissions | -rw-r--r-- |
36511 | 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 |
|
23 |
* questions. |
|
24 |
*/ |
|
25 |
||
26 |
package java.lang.module; |
|
27 |
||
28 |
import java.io.ByteArrayInputStream; |
|
29 |
import java.io.IOException; |
|
30 |
import java.io.InputStream; |
|
31 |
import java.io.UncheckedIOException; |
|
32 |
import java.net.URI; |
|
33 |
import java.net.URLConnection; |
|
34 |
import java.nio.ByteBuffer; |
|
41817
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
35 |
import java.util.ArrayDeque; |
36511 | 36 |
import java.util.Collections; |
41817
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
37 |
import java.util.Deque; |
36511 | 38 |
import java.util.HashMap; |
39 |
import java.util.HashSet; |
|
41817
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
40 |
import java.util.Iterator; |
36511 | 41 |
import java.util.Map; |
42 |
import java.util.Objects; |
|
43 |
import java.util.Optional; |
|
44 |
import java.util.Set; |
|
41817
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
45 |
import java.util.Spliterator; |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
46 |
import java.util.function.Consumer; |
36511 | 47 |
import java.util.function.Supplier; |
41817
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
48 |
import java.util.stream.Stream; |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
49 |
import java.util.stream.StreamSupport; |
36511 | 50 |
|
51 |
import jdk.internal.jimage.ImageLocation; |
|
52 |
import jdk.internal.jimage.ImageReader; |
|
53 |
import jdk.internal.jimage.ImageReaderFactory; |
|
41555
8a2a5a88376a
8168073: Speed up URI creation during module bootstrap
redestad
parents:
40261
diff
changeset
|
54 |
import jdk.internal.misc.JavaNetUriAccess; |
8a2a5a88376a
8168073: Speed up URI creation during module bootstrap
redestad
parents:
40261
diff
changeset
|
55 |
import jdk.internal.misc.SharedSecrets; |
37779
7c84df693837
8154956: Module system implementation refresh (4/2016)
alanb
parents:
36511
diff
changeset
|
56 |
import jdk.internal.module.ModuleHashes; |
38431
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
57 |
import jdk.internal.module.ModuleHashes.HashSupplier; |
36511 | 58 |
import jdk.internal.module.SystemModules; |
59 |
import jdk.internal.module.ModulePatcher; |
|
60 |
import jdk.internal.perf.PerfCounter; |
|
61 |
||
62 |
/** |
|
63 |
* A {@code ModuleFinder} that finds modules that are linked into the |
|
64 |
* run-time image. |
|
65 |
* |
|
66 |
* The modules linked into the run-time image are assumed to have the |
|
67 |
* ConcealedPackages attribute. |
|
68 |
*/ |
|
69 |
||
70 |
class SystemModuleFinder implements ModuleFinder { |
|
71 |
||
41817
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
72 |
private static final JavaNetUriAccess JNUA = SharedSecrets.getJavaNetUriAccess(); |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
73 |
|
36511 | 74 |
private static final PerfCounter initTime |
75 |
= PerfCounter.newPerfCounter("jdk.module.finder.jimage.initTime"); |
|
76 |
private static final PerfCounter moduleCount |
|
77 |
= PerfCounter.newPerfCounter("jdk.module.finder.jimage.modules"); |
|
78 |
private static final PerfCounter packageCount |
|
79 |
= PerfCounter.newPerfCounter("jdk.module.finder.jimage.packages"); |
|
80 |
private static final PerfCounter exportsCount |
|
81 |
= PerfCounter.newPerfCounter("jdk.module.finder.jimage.exports"); |
|
82 |
// ImageReader used to access all modules in the image |
|
83 |
private static final ImageReader imageReader; |
|
84 |
||
85 |
// the set of modules in the run-time image |
|
86 |
private static final Set<ModuleReference> modules; |
|
87 |
||
88 |
// maps module name to module reference |
|
89 |
private static final Map<String, ModuleReference> nameToModule; |
|
90 |
||
91 |
/** |
|
92 |
* For now, the module references are created eagerly on the assumption |
|
93 |
* that service binding will require all modules to be located. |
|
94 |
*/ |
|
95 |
static { |
|
96 |
long t0 = System.nanoTime(); |
|
97 |
imageReader = ImageReaderFactory.getImageReader(); |
|
98 |
||
38431
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
99 |
String[] names = moduleNames(); |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
100 |
ModuleDescriptor[] descriptors = descriptors(names); |
36511 | 101 |
|
38431
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
102 |
int n = names.length; |
36511 | 103 |
moduleCount.add(n); |
104 |
||
105 |
Set<ModuleReference> mods = new HashSet<>(n); |
|
106 |
Map<String, ModuleReference> map = new HashMap<>(n); |
|
107 |
||
108 |
for (int i = 0; i < n; i++) { |
|
38431
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
109 |
ModuleDescriptor md = descriptors[i]; |
36511 | 110 |
|
111 |
// create the ModuleReference |
|
38431
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
112 |
ModuleReference mref = toModuleReference(md, hashSupplier(i, names[i])); |
36511 | 113 |
|
114 |
mods.add(mref); |
|
38431
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
115 |
map.put(names[i], mref); |
36511 | 116 |
|
117 |
// counters |
|
118 |
packageCount.add(md.packages().size()); |
|
119 |
exportsCount.add(md.exports().size()); |
|
120 |
} |
|
121 |
||
122 |
modules = Collections.unmodifiableSet(mods); |
|
123 |
nameToModule = map; |
|
124 |
||
125 |
initTime.addElapsedTimeFrom(t0); |
|
126 |
} |
|
127 |
||
38431
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
128 |
/* |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
129 |
* Returns an array of ModuleDescriptor of the given module names. |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
130 |
* |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
131 |
* This obtains ModuleDescriptors from SystemModules class that is generated |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
132 |
* from the jlink system-modules plugin. ModuleDescriptors have already |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
133 |
* been validated at link time. |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
134 |
* |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
135 |
* If java.base is patched, or fastpath is disabled for troubleshooting |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
136 |
* purpose, it will fall back to find system modules via jrt file system. |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
137 |
*/ |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
138 |
private static ModuleDescriptor[] descriptors(String[] names) { |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
139 |
// fastpath is enabled by default. |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
140 |
// It can be disabled for troubleshooting purpose. |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
141 |
boolean disabled = |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
142 |
System.getProperty("jdk.system.module.finder.disabledFastPath") != null; |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
143 |
|
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
144 |
// fast loading of ModuleDescriptor of system modules |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
145 |
if (isFastPathSupported() && !disabled) |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
146 |
return SystemModules.modules(); |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
147 |
|
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
148 |
// if fast loading of ModuleDescriptors is disabled |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
149 |
// fallback to read module-info.class |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
150 |
ModuleDescriptor[] descriptors = new ModuleDescriptor[names.length]; |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
151 |
for (int i = 0; i < names.length; i++) { |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
152 |
String mn = names[i]; |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
153 |
ImageLocation loc = imageReader.findLocation(mn, "module-info.class"); |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
154 |
descriptors[i] = ModuleDescriptor.read(imageReader.getResourceBuffer(loc)); |
37779
7c84df693837
8154956: Module system implementation refresh (4/2016)
alanb
parents:
36511
diff
changeset
|
155 |
|
38431
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
156 |
// add the recorded hashes of tied modules |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
157 |
Hashes.add(descriptors[i]); |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
158 |
} |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
159 |
return descriptors; |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
160 |
} |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
161 |
|
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
162 |
private static boolean isFastPathSupported() { |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
163 |
return SystemModules.MODULE_NAMES.length > 0; |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
164 |
} |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
165 |
|
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
166 |
private static String[] moduleNames() { |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
167 |
if (isFastPathSupported()) |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
168 |
// module names recorded at link time |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
169 |
return SystemModules.MODULE_NAMES; |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
170 |
|
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
171 |
// this happens when java.base is patched with java.base |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
172 |
// from an exploded image |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
173 |
return imageReader.getModuleNames(); |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
174 |
} |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
175 |
|
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
176 |
private static ModuleReference toModuleReference(ModuleDescriptor md, |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
177 |
HashSupplier hash) |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
178 |
{ |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
179 |
String mn = md.name(); |
41817
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
180 |
URI uri = JNUA.create("jrt", "/".concat(mn)); |
38431
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
181 |
|
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
182 |
Supplier<ModuleReader> readerSupplier = new Supplier<>() { |
37779
7c84df693837
8154956: Module system implementation refresh (4/2016)
alanb
parents:
36511
diff
changeset
|
183 |
@Override |
38431
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
184 |
public ModuleReader get() { |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
185 |
return new ImageModuleReader(mn, uri); |
37779
7c84df693837
8154956: Module system implementation refresh (4/2016)
alanb
parents:
36511
diff
changeset
|
186 |
} |
7c84df693837
8154956: Module system implementation refresh (4/2016)
alanb
parents:
36511
diff
changeset
|
187 |
}; |
38431
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
188 |
|
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
189 |
ModuleReference mref = |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
190 |
new ModuleReference(md, uri, readerSupplier, hash); |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
191 |
|
40261
86a49ba76f52
8136930: Simplify use of module-system options by custom launchers
mchung
parents:
38565
diff
changeset
|
192 |
// may need a reference to a patched module if --patch-module specified |
38431
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
193 |
mref = ModulePatcher.interposeIfNeeded(mref); |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
194 |
|
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
195 |
return mref; |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
196 |
} |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
197 |
|
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
198 |
private static HashSupplier hashSupplier(int index, String name) { |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
199 |
if (isFastPathSupported()) { |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
200 |
return new HashSupplier() { |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
201 |
@Override |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
202 |
public String generate(String algorithm) { |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
203 |
return SystemModules.MODULES_TO_HASH[index]; |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
204 |
} |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
205 |
}; |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
206 |
} else { |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
207 |
return Hashes.hashFor(name); |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
208 |
} |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
209 |
} |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
210 |
|
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
211 |
/* |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
212 |
* This helper class is only used when SystemModules is patched. |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
213 |
* It will get the recorded hashes from module-info.class. |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
214 |
*/ |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
215 |
private static class Hashes { |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
216 |
static Map<String, String> hashes = new HashMap<>(); |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
217 |
|
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
218 |
static void add(ModuleDescriptor descriptor) { |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
219 |
Optional<ModuleHashes> ohashes = descriptor.hashes(); |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
220 |
if (ohashes.isPresent()) { |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
221 |
hashes.putAll(ohashes.get().hashes()); |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
222 |
} |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
223 |
} |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
224 |
|
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
225 |
static HashSupplier hashFor(String name) { |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
226 |
if (!hashes.containsKey(name)) |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
227 |
return null; |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
228 |
|
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
229 |
return new HashSupplier() { |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
230 |
@Override |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
231 |
public String generate(String algorithm) { |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
232 |
return hashes.get(name); |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
233 |
} |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
234 |
}; |
ed73e79a0eb4
8157068: ExceptionInInitializerError if images build patched to use exploded version of jdk.internal.module.SystemModules
mchung
parents:
37779
diff
changeset
|
235 |
} |
37779
7c84df693837
8154956: Module system implementation refresh (4/2016)
alanb
parents:
36511
diff
changeset
|
236 |
} |
7c84df693837
8154956: Module system implementation refresh (4/2016)
alanb
parents:
36511
diff
changeset
|
237 |
|
36511 | 238 |
SystemModuleFinder() { } |
239 |
||
240 |
@Override |
|
241 |
public Optional<ModuleReference> find(String name) { |
|
242 |
Objects.requireNonNull(name); |
|
243 |
return Optional.ofNullable(nameToModule.get(name)); |
|
244 |
} |
|
245 |
||
246 |
@Override |
|
247 |
public Set<ModuleReference> findAll() { |
|
248 |
return modules; |
|
249 |
} |
|
250 |
||
251 |
||
252 |
/** |
|
253 |
* A ModuleReader for reading resources from a module linked into the |
|
254 |
* run-time image. |
|
255 |
*/ |
|
256 |
static class ImageModuleReader implements ModuleReader { |
|
257 |
private final String module; |
|
258 |
private volatile boolean closed; |
|
259 |
||
260 |
/** |
|
261 |
* If there is a security manager set then check permission to |
|
262 |
* connect to the run-time image. |
|
263 |
*/ |
|
264 |
private static void checkPermissionToConnect(URI uri) { |
|
265 |
SecurityManager sm = System.getSecurityManager(); |
|
266 |
if (sm != null) { |
|
267 |
try { |
|
268 |
URLConnection uc = uri.toURL().openConnection(); |
|
269 |
sm.checkPermission(uc.getPermission()); |
|
270 |
} catch (IOException ioe) { |
|
271 |
throw new UncheckedIOException(ioe); |
|
272 |
} |
|
273 |
} |
|
274 |
} |
|
275 |
||
276 |
ImageModuleReader(String module, URI uri) { |
|
277 |
checkPermissionToConnect(uri); |
|
278 |
this.module = module; |
|
279 |
} |
|
280 |
||
281 |
/** |
|
282 |
* Returns the ImageLocation for the given resource, {@code null} |
|
283 |
* if not found. |
|
284 |
*/ |
|
285 |
private ImageLocation findImageLocation(String name) throws IOException { |
|
38565
e97761823da2
8156142: ModuleReader instances don't always throw NPE for passed null args
alanb
parents:
38431
diff
changeset
|
286 |
Objects.requireNonNull(name); |
36511 | 287 |
if (closed) |
288 |
throw new IOException("ModuleReader is closed"); |
|
289 |
if (imageReader != null) { |
|
290 |
return imageReader.findLocation(module, name); |
|
291 |
} else { |
|
292 |
// not an images build |
|
293 |
return null; |
|
294 |
} |
|
295 |
} |
|
296 |
||
297 |
@Override |
|
298 |
public Optional<URI> find(String name) throws IOException { |
|
299 |
ImageLocation location = findImageLocation(name); |
|
300 |
if (location != null) { |
|
301 |
URI u = URI.create("jrt:/" + module + "/" + name); |
|
302 |
return Optional.of(u); |
|
303 |
} else { |
|
304 |
return Optional.empty(); |
|
305 |
} |
|
306 |
} |
|
307 |
||
308 |
@Override |
|
309 |
public Optional<InputStream> open(String name) throws IOException { |
|
310 |
return read(name).map(this::toInputStream); |
|
311 |
} |
|
312 |
||
313 |
private InputStream toInputStream(ByteBuffer bb) { // ## -> ByteBuffer? |
|
314 |
try { |
|
315 |
int rem = bb.remaining(); |
|
316 |
byte[] bytes = new byte[rem]; |
|
317 |
bb.get(bytes); |
|
318 |
return new ByteArrayInputStream(bytes); |
|
319 |
} finally { |
|
320 |
release(bb); |
|
321 |
} |
|
322 |
} |
|
323 |
||
324 |
@Override |
|
325 |
public Optional<ByteBuffer> read(String name) throws IOException { |
|
326 |
ImageLocation location = findImageLocation(name); |
|
327 |
if (location != null) { |
|
328 |
return Optional.of(imageReader.getResourceBuffer(location)); |
|
329 |
} else { |
|
330 |
return Optional.empty(); |
|
331 |
} |
|
332 |
} |
|
333 |
||
334 |
@Override |
|
335 |
public void release(ByteBuffer bb) { |
|
38565
e97761823da2
8156142: ModuleReader instances don't always throw NPE for passed null args
alanb
parents:
38431
diff
changeset
|
336 |
Objects.requireNonNull(bb); |
36511 | 337 |
ImageReader.releaseByteBuffer(bb); |
338 |
} |
|
339 |
||
340 |
@Override |
|
41817
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
341 |
public Stream<String> list() throws IOException { |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
342 |
if (closed) |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
343 |
throw new IOException("ModuleReader is closed"); |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
344 |
|
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
345 |
Spliterator<String> s = new ModuleContentSpliterator(module); |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
346 |
return StreamSupport.stream(s, false); |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
347 |
} |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
348 |
|
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
349 |
@Override |
36511 | 350 |
public void close() { |
351 |
// nothing else to do |
|
352 |
closed = true; |
|
353 |
} |
|
354 |
} |
|
355 |
||
41817
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
356 |
/** |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
357 |
* A Spliterator for traversing the resources of a module linked into the |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
358 |
* run-time image. |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
359 |
*/ |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
360 |
static class ModuleContentSpliterator implements Spliterator<String> { |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
361 |
final String moduleRoot; |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
362 |
final Deque<ImageReader.Node> stack; |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
363 |
Iterator<ImageReader.Node> iterator; |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
364 |
|
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
365 |
ModuleContentSpliterator(String module) throws IOException { |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
366 |
moduleRoot = "/modules/" + module; |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
367 |
stack = new ArrayDeque<>(); |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
368 |
|
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
369 |
// push the root node to the stack to get started |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
370 |
ImageReader.Node dir = imageReader.findNode(moduleRoot); |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
371 |
if (dir == null || !dir.isDirectory()) |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
372 |
throw new IOException(moduleRoot + " not a directory"); |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
373 |
stack.push(dir); |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
374 |
iterator = Collections.emptyIterator(); |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
375 |
} |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
376 |
|
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
377 |
/** |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
378 |
* Returns the name of the next non-directory node or {@code null} if |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
379 |
* there are no remaining nodes to visit. |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
380 |
*/ |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
381 |
private String next() throws IOException { |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
382 |
for (;;) { |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
383 |
while (iterator.hasNext()) { |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
384 |
ImageReader.Node node = iterator.next(); |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
385 |
String name = node.getName(); |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
386 |
if (node.isDirectory()) { |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
387 |
// build node |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
388 |
ImageReader.Node dir = imageReader.findNode(name); |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
389 |
assert dir.isDirectory(); |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
390 |
stack.push(dir); |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
391 |
} else { |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
392 |
// strip /modules/$MODULE/ prefix |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
393 |
return name.substring(moduleRoot.length() + 1); |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
394 |
} |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
395 |
} |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
396 |
|
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
397 |
if (stack.isEmpty()) { |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
398 |
return null; |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
399 |
} else { |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
400 |
ImageReader.Node dir = stack.poll(); |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
401 |
assert dir.isDirectory(); |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
402 |
iterator = dir.getChildren().iterator(); |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
403 |
} |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
404 |
} |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
405 |
} |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
406 |
|
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
407 |
@Override |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
408 |
public boolean tryAdvance(Consumer<? super String> action) { |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
409 |
String next; |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
410 |
try { |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
411 |
next = next(); |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
412 |
} catch (IOException ioe) { |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
413 |
throw new UncheckedIOException(ioe); |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
414 |
} |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
415 |
if (next != null) { |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
416 |
action.accept(next); |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
417 |
return true; |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
418 |
} else { |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
419 |
return false; |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
420 |
} |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
421 |
} |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
422 |
|
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
423 |
@Override |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
424 |
public Spliterator<String> trySplit() { |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
425 |
return null; |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
426 |
} |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
427 |
|
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
428 |
@Override |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
429 |
public int characteristics() { |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
430 |
return Spliterator.DISTINCT + Spliterator.NONNULL + Spliterator.IMMUTABLE; |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
431 |
} |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
432 |
|
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
433 |
@Override |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
434 |
public long estimateSize() { |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
435 |
return Long.MAX_VALUE; |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
436 |
} |
b90ad1de93ea
8168789: ModuleReader.list and ModuleFinder.of update
alanb
parents:
41555
diff
changeset
|
437 |
} |
36511 | 438 |
} |