Skip to content

Commit 7a8a7bb

Browse files
committed
Make spotless happy
1 parent cf62094 commit 7a8a7bb

File tree

2 files changed

+43
-41
lines changed

2 files changed

+43
-41
lines changed

org.graalvm.python.embedding/src/main/java/org/graalvm/python/embedding/VirtualFileSystem.java

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ public static final class Builder {
107107
private HostIO allowHostIO = HostIO.READ_WRITE;
108108
private boolean caseInsensitive = VirtualFileSystemImpl.isWindows();
109109

110-
private ClassLoader resourceClassLoader;
110+
private ClassLoader resourceClassLoader;
111111

112112
private String resourceDirectory;
113113

@@ -244,7 +244,8 @@ public Builder unixMountPoint(String unixMountPoint) {
244244
* cases when for example <code>VirtualFileSystem</code> is on module path and
245245
* the jar containing the resources is on class path.
246246
*
247-
* @param c the class for loading the resources
247+
* @param c
248+
* the class for loading the resources
248249
* @return the builder
249250
* @since 24.2.0
250251
*/
@@ -253,21 +254,22 @@ public Builder resourceLoadingClass(Class<?> c) {
253254
return this;
254255
}
255256

256-
/**
257-
* By default, virtual filesystem resources are loaded by delegating to
258-
* <code>VirtualFileSystem.class.getClassLoader().getResource(name)</code>. Use
259-
* <code>resourceClassLoader</code> to determine where to locate resources in
260-
* cases when for example <code>VirtualFileSystem</code> is on module path and
261-
* the jar containing the resources is on class path.
262-
*
263-
* @param cl the classloader used to load resources
264-
* @return this builder
265-
* @since 26.0.0
266-
*/
267-
public Builder resourceClassLoader(ClassLoader cl) {
268-
resourceClassLoader = cl;
269-
return this;
270-
}
257+
/**
258+
* By default, virtual filesystem resources are loaded by delegating to
259+
* <code>VirtualFileSystem.class.getClassLoader().getResource(name)</code>. Use
260+
* <code>resourceClassLoader</code> to determine where to locate resources in
261+
* cases when for example <code>VirtualFileSystem</code> is on module path and
262+
* the jar containing the resources is on class path.
263+
*
264+
* @param cl
265+
* the classloader used to load resources
266+
* @return this builder
267+
* @since 26.0.0
268+
*/
269+
public Builder resourceClassLoader(ClassLoader cl) {
270+
resourceClassLoader = cl;
271+
return this;
272+
}
271273

272274
/**
273275
* This filter applied to files in the virtual filesystem treats them as
@@ -308,8 +310,8 @@ public VirtualFileSystem build() {
308310
? Path.of(DEFAULT_WINDOWS_MOUNT_POINT)
309311
: Path.of(DEFAULT_UNIX_MOUNT_POINT);
310312
}
311-
return new VirtualFileSystem(extractFilter, mountPoint, allowHostIO, resourceClassLoader,
312-
resourceDirectory, caseInsensitive);
313+
return new VirtualFileSystem(extractFilter, mountPoint, allowHostIO, resourceClassLoader, resourceDirectory,
314+
caseInsensitive);
313315
}
314316
}
315317

@@ -327,7 +329,7 @@ private VirtualFileSystem(Predicate<Path> extractFilter, Path mountPoint, HostIO
327329
ClassLoader resourceClassLoader, String resourceDirectory, boolean caseInsensitive) {
328330

329331
this.impl = new VirtualFileSystemImpl(extractFilter, mountPoint, resourceDirectory, allowHostIO,
330-
resourceClassLoader, caseInsensitive);
332+
resourceClassLoader, caseInsensitive);
331333
this.delegatingFileSystem = VirtualFileSystemImpl.createDelegatingFileSystem(impl);
332334
}
333335

org.graalvm.python.embedding/src/main/java/org/graalvm/python/embedding/VirtualFileSystemImpl.java

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -169,12 +169,12 @@ private static String absoluteResourcePath(String... components) {
169169
* Maps platform-specific paths to entries.
170170
*/
171171
private final Map<String, BaseEntry> vfsEntries = new HashMap<>();
172-
173-
/**
174-
* Classloader used to read resources. By defaut, the classloader of
175-
* VirtualFileSystem.class.
176-
*/
177-
private final ClassLoader resourceClassLoader;
172+
173+
/**
174+
* Classloader used to read resources. By defaut, the classloader of
175+
* VirtualFileSystem.class.
176+
*/
177+
private final ClassLoader resourceClassLoader;
178178

179179
static final String PLATFORM_SEPARATOR = Paths.get("").getFileSystem().getSeparator();
180180
private static final char RESOURCE_SEPARATOR_CHAR = '/';
@@ -311,24 +311,26 @@ private void removeExtractDir() {
311311
*/
312312
VirtualFileSystemImpl(Predicate<Path> extractFilter, Path mountPoint, String resourceDirectory, HostIO allowHostIO,
313313
ClassLoader resourceClassLoader, boolean caseInsensitive) {
314-
if (resourceClassLoader != null) {
315-
this.resourceClassLoader = resourceClassLoader;
316-
} else {
317-
this.resourceClassLoader = VirtualFileSystem.class.getClassLoader();
318-
}
314+
if (resourceClassLoader != null) {
315+
this.resourceClassLoader = resourceClassLoader;
316+
} else {
317+
this.resourceClassLoader = VirtualFileSystem.class.getClassLoader();
318+
}
319319
this.caseInsensitive = caseInsensitive;
320320
this.mountPoint = mountPoint;
321321
this.mountPointLowerCase = mountPoint.toString().toLowerCase(Locale.ROOT);
322322
this.vfsRoot = resourceDirectory == null ? DEFAULT_VFS_ROOT : resourceDirectory;
323323
this.platformVenvPath = resourcePathToPlatformPath(absoluteResourcePath(vfsRoot, VFS_VENV));
324324
this.platformSrcPath = resourcePathToPlatformPath(absoluteResourcePath(vfsRoot, VFS_SRC));
325325

326-
if (LOGGER.isLoggable(Level.FINE)) {
327-
var classLoaderLabel = this.resourceClassLoader == VirtualFileSystem.class.getClassLoader() ? "VirtualFileSystem" : "custom";
328-
fine("VirtualFilesystem %s, allowHostIO: %s, resourceClassLoader: %s, caseInsensitive: %s, extractOnStartup: %s%s",
329-
mountPoint, allowHostIO.toString(), classLoaderLabel, caseInsensitive,
330-
extractOnStartup, extractFilter != null ? "" : ", extractFilter: null");
331-
}
326+
if (LOGGER.isLoggable(Level.FINE)) {
327+
var classLoaderLabel = this.resourceClassLoader == VirtualFileSystem.class.getClassLoader()
328+
? "VirtualFileSystem"
329+
: "custom";
330+
fine("VirtualFilesystem %s, allowHostIO: %s, resourceClassLoader: %s, caseInsensitive: %s, extractOnStartup: %s%s",
331+
mountPoint, allowHostIO.toString(), classLoaderLabel, caseInsensitive, extractOnStartup,
332+
extractFilter != null ? "" : ", extractFilter: null");
333+
}
332334
this.extractFilter = extractFilter;
333335
if (extractFilter != null) {
334336
try {
@@ -747,8 +749,7 @@ private void validateMultipleVFSLocations(List<URL> filelistUrls) {
747749
// by the Maven/Gradle plugin and should contain "pip freeze" of the venv
748750
ArrayList<URL> installedUrls;
749751
try {
750-
installedUrls = Collections.list(
751-
resourceClassLoader.getResources(resourcePath(vfsRoot, INSTALLED_FILE)));
752+
installedUrls = Collections.list(resourceClassLoader.getResources(resourcePath(vfsRoot, INSTALLED_FILE)));
752753
} catch (IOException e) {
753754
warn("Cannot check compatibility of the merged virtual environments. Cannot read list of packages installed in the virtual environments. IOException: "
754755
+ e.getMessage());
@@ -792,8 +793,7 @@ private void validateMultipleVFSLocations(List<URL> filelistUrls) {
792793
// Check compatibility of GraalPy versions that were used to create the VFSs
793794
ArrayList<URL> contentsUrls;
794795
try {
795-
contentsUrls = Collections.list(
796-
resourceClassLoader.getResources(resourcePath(vfsRoot, CONTENTS_FILE)));
796+
contentsUrls = Collections.list(resourceClassLoader.getResources(resourcePath(vfsRoot, CONTENTS_FILE)));
797797
} catch (IOException e) {
798798
warn("Cannot check compatibility of the merged virtual environments. Cannot read GraalPy version of the virtual environments. IOException: "
799799
+ e.getMessage());

0 commit comments

Comments
 (0)