Skip to content

Commit 8d88db0

Browse files
ivan-ristovicolpaw
authored andcommitted
Fix several style issues
1 parent d39874f commit 8d88db0

File tree

1 file changed

+30
-29
lines changed

1 file changed

+30
-29
lines changed

substratevm/src/com.oracle.svm.hosted.jdk11/src/com/oracle/svm/hosted/ModuleLayerFeature.java

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ public void afterRegistration(AfterRegistrationAccess access) {
117117
public void beforeAnalysis(BeforeAnalysisAccess access) {
118118
FeatureImpl.BeforeAnalysisAccessImpl accessImpl = (FeatureImpl.BeforeAnalysisAccessImpl) access;
119119
Set<String> baseModules = ModuleLayer.boot().modules()
120-
.stream()
121-
.map(Module::getName)
122-
.collect(Collectors.toSet());
120+
.stream()
121+
.map(Module::getName)
122+
.collect(Collectors.toSet());
123123
ModuleLayer runtimeBootLayer = synthesizeRuntimeBootLayer(accessImpl.imageClassLoader, baseModules);
124124
BootModuleLayerSupport.instance().setBootLayer(runtimeBootLayer);
125125
}
@@ -130,16 +130,16 @@ public void afterAnalysis(AfterAnalysisAccess access) {
130130
AnalysisUniverse universe = accessImpl.getUniverse();
131131

132132
Stream<Module> analysisReachableModules = universe.getTypes()
133-
.stream()
134-
.filter(t -> t.isReachable() && !t.isArray())
135-
.map(t -> t.getJavaClass().getModule())
136-
.distinct();
133+
.stream()
134+
.filter(t -> t.isReachable() && !t.isArray())
135+
.map(t -> t.getJavaClass().getModule())
136+
.distinct();
137137

138138
Set<String> allReachableModules = analysisReachableModules
139-
.filter(Module::isNamed)
140-
.filter(m -> !m.getDescriptor().modifiers().contains(ModuleDescriptor.Modifier.SYNTHETIC))
141-
.flatMap(ModuleLayerFeature::extractRequiredModuleNames)
142-
.collect(Collectors.toSet());
139+
.filter(Module::isNamed)
140+
.filter(m -> !m.getDescriptor().modifiers().contains(ModuleDescriptor.Modifier.SYNTHETIC))
141+
.flatMap(ModuleLayerFeature::extractRequiredModuleNames)
142+
.collect(Collectors.toSet());
143143

144144
ModuleLayer runtimeBootLayer = synthesizeRuntimeBootLayer(accessImpl.imageClassLoader, allReachableModules);
145145
BootModuleLayerSupport.instance().setBootLayer(runtimeBootLayer);
@@ -203,19 +203,19 @@ static class BootModuleLayerModuleFinder implements ModuleFinder {
203203
@Override
204204
public Optional<ModuleReference> find(String name) {
205205
return ModuleLayer.boot()
206-
.configuration()
207-
.findModule(name)
208-
.map(ResolvedModule::reference);
206+
.configuration()
207+
.findModule(name)
208+
.map(ResolvedModule::reference);
209209
}
210210

211211
@Override
212212
public Set<ModuleReference> findAll() {
213213
return ModuleLayer.boot()
214-
.configuration()
215-
.modules()
216-
.stream()
217-
.map(ResolvedModule::reference)
218-
.collect(Collectors.toSet());
214+
.configuration()
215+
.modules()
216+
.stream()
217+
.map(ResolvedModule::reference)
218+
.collect(Collectors.toSet());
219219
}
220220
}
221221

@@ -255,26 +255,27 @@ private static final class NameToModuleSynthesizer {
255255
moduleFindModuleMethod = ReflectionUtil.lookupMethod(Module.class, "findModule", String.class, Map.class, Map.class, List.class);
256256
}
257257

258-
private Field findFieldByName(Field[] fields, String name) {
258+
private static Field findFieldByName(Field[] fields, String name) {
259259
return Arrays.stream(fields).filter(f -> f.getName().equals(name)).findAny().get();
260260
}
261261

262262
/**
263-
* This method creates Module instances that will populate the runtime boot module layer of the image.
264-
* This implementation is copy-pasted from Module#defineModules(Configuration, Function, ModuleLayer)
265-
* with few simplifications (removing multiple classloader support) and removal of VM state updates
266-
* (otherwise we would be re-defining modules to the host VM).
263+
* This method creates Module instances that will populate the runtime boot module layer of
264+
* the image. This implementation is copy-pasted from Module#defineModules(Configuration,
265+
* Function, ModuleLayer) with few simplifications (removing multiple classloader support)
266+
* and removal of VM state updates (otherwise we would be re-defining modules to the host
267+
* VM).
267268
*/
268269
Map<String, Module> synthesizeNameToModule(ModuleLayer runtimeBootLayer, ClassLoader cl)
269-
throws IllegalAccessException, InvocationTargetException, InstantiationException {
270+
throws IllegalAccessException, InvocationTargetException, InstantiationException {
270271
Configuration cf = runtimeBootLayer.configuration();
271272

272273
int cap = (int) (cf.modules().size() / 0.75f + 1.0f);
273274
Map<String, Module> nameToModule = new HashMap<>(cap);
274275

275276
/*
276-
* Remove mapping of modules to classloaders.
277-
* Create module instances without defining them to the VM
277+
* Remove mapping of modules to classloaders. Create module instances without defining
278+
* them to the VM
278279
*/
279280
for (ResolvedModule resolvedModule : cf.modules()) {
280281
ModuleReference mref = resolvedModule.reference();
@@ -286,8 +287,8 @@ Map<String, Module> synthesizeNameToModule(ModuleLayer runtimeBootLayer, ClassLo
286287
}
287288

288289
/*
289-
* Setup readability and exports/opens.
290-
* This part is unchanged, save for field setters and VM update removals
290+
* Setup readability and exports/opens. This part is unchanged, save for field setters
291+
* and VM update removals
291292
*/
292293
for (ResolvedModule resolvedModule : cf.modules()) {
293294
ModuleReference mref = resolvedModule.reference();

0 commit comments

Comments
 (0)