You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Psudo of what the function should be: f -> newConf.modules.contains(d) ? classLoader : parent.stream().findFirst(l -> l.contains(f)).map(Layer::getClassLoader).orElse(classLoader)
This causes service loaders for things like SLF4J to fail if they are first loaded from the MC context, which, in 1.18.2 they are.
The text was updated successfully, but these errors were encountered:
I tried to implement it in the way you described. Unfortunally, this did not work. This is because Module.java only calls the function for modules of that classloader, and not it's parents.
I currently also don't see any other way to get the log4j2 service info into the transforming class loader.
From testing myself, it looks like this is not directly possible with the current setup. As @ichttt already stated Module.java has a weird corner case here and I doubt we could modify its behavior enough to make it work. Optionally we could make the ServiceLoader use an adapted route through the classloader and combine all service specifications from the parent layers into one?
…#52)
The fix is just to call the package-private
`ModuleLayer.bindToLoader(ClassLoader)` method on the parent layers when
creating the `ModuleClassLoader`.
The rest of the PR is a complicated testing setup, to make sure that we
can test with both CP-loaded and SJH-loaded source sets.
ClosesMcModLauncher/modlauncher#100.
The last argument to defineModules is a function that looks up a module, and it's associated class loader.
This should return the correct classloader for that specific module which is required to trigger bindToLayer, which is required for the service catalog.
Psudo of what the function should be:
f -> newConf.modules.contains(d) ? classLoader : parent.stream().findFirst(l -> l.contains(f)).map(Layer::getClassLoader).orElse(classLoader)
This causes service loaders for things like SLF4J to fail if they are first loaded from the MC context, which, in 1.18.2 they are.
The text was updated successfully, but these errors were encountered: