Skip to content

Commit 9612ce0

Browse files
committed
Pass service class loader to service loader
1 parent 93b4ba9 commit 9612ce0

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

common/src/main/java/dev/terminalmc/framework/platform/Services.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ public class Services {
2020

2121
public static final IPlatformServices PLATFORM = load(IPlatformServices.class);
2222

23-
public static <T> T load(Class<T> clazz) {
24-
final T loadedService = ServiceLoader.load(clazz)
23+
public static <T> T load(Class<T> service) {
24+
final T loadedService = ServiceLoader.load(service, service.getClassLoader())
2525
.findFirst()
2626
.orElseThrow(() -> new NullPointerException(
27-
"Failed to load service for " + clazz.getName()));
28-
Framework.LOG.debug("Loaded {} for service {}", loadedService, clazz);
27+
"Failed to load service for " + service.getName()));
28+
Framework.LOG.debug("Loaded {} for service {}", loadedService, service);
2929
return loadedService;
3030
}
3131
}

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
# All other plural properties expect CSV list format.
88

99
# Template Project Sync Version
10-
template_version=8
10+
template_version=9
1111

1212
# Mod Version
1313
mod_version=0.1.0

template-changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,14 @@ from the template.
55

66
If not deleted manually, this file will be deleted when running the `rebrandProject` Gradle task.
77

8+
## 9
9+
10+
- Fixed service loader potentially using the wrong classloader
11+
12+
Affected files:
13+
14+
- `common/src/main/java/dev/terminalmc/framework/platform/Services.java`
15+
816
## 8
917

1018
- Fixed placeholder screen close behavior

0 commit comments

Comments
 (0)