New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[1.19] IllegalAccessError when LANGPROVIDER tries to access a module from its JarJar dependencies while loading mod #8878
Comments
This is not the way to package kotlin. I suspect it would work fine if the kotlin for forge langprovider was shadowed with kotlin. Otherwise you'd need to get a version of kotlin that is properly jpms aware. Given they're still shipping jdk7! compatible libs that's likely a few years away yet. |
The example mod can access the Kotlin libraries when they are shadowed by the langprovider, but when the langprovider is shadowed alongside Kotlin, Forge doesn't detect the langprovider when it's needed by the example mod. |
I am checking this now |
After further testing I have succeed in making minecraft to be aware of kotlin language provider But it's still unable to access kotlin libs
|
I tracked the issue down to the kotlin libs and wing unaware of fmls systems and as such being injected into the game layer and not the plugin/service layers |
Note due to changes needed in signatures of objects this will likely target 1.20. In short: Line 86 in bb48186
|
Do you know of a workaround to use in the meantime? |
No this was hardcoded into the mod provider at the time. |
Question: WHY can't you just fatjar kotlin with the kotlin4forge? That was my original question, and it still hasn't been answered. |
Wasn't this one what you meant? Putting kotlin std libs along side with language provider |
Basically he is saying that LanguageProviders should be a fatjar, with the libraries shaded into it without relocation. |
Yes, shadowing does work. |
This is what Kotlin For Forge does, and it breaks every single other mod that wants to include kotlin without a hard dependency on Kotlin For Forge. Given that language providers can't be JIJed (even if we don't need the lang provider, just kotlin stdlib!), this means that mods MUST require their users to manually download Kotlin For Forge, including every single kotlin library, even those the mod doesn't need (by necessity, because they don't support JPMS and forge loads every JAR on the module path), which is a sorry state of affairs. |
You can jij a language provider. But a lang provider can not jij itself for reasons we have discussed before: it is unclear where what version of the library goes. So for yes and language provider that has its own does needs to be downloaded. |
This is not true. Including Kotlin For Forge via JIJ will crash the game on startup with a ResolutionException if the player already has Kotlin For Forge in their |
The goal I have here is to have the lang provider jij a gamelibrary and the Kotlin libs. Previously I had it working where the game library is all inline functions, but that dumps a bunch of duplicated bytecode into other mods and it limits changing the library in the future. |
Shadowing Kotlin while JiJ everything else works, although it would be ideal to have Kotlin as a JarJar library instead of a shadowed one. |
This is know and as of now a not supported scenario. A none fml aware library will always be put into beh game layer and there is no effective way to change that. Any launch plugin like a language provider should shadow its dependencies. |
This is very bad for the aforementioned reason that it forces mods that need kotlin to not only have a hard dependency on kotlin for forge (or create an incompatibility), but also to force users to manually download it because it cannot be JIJ'd. Is there a recommended solution for this issue? |
The language loader can be jar in jarred. This is currently a concequence of the way it is setup. And is the status quo when it comes to language loaders even from before jar in jar. |
Should I make a separate issue then? Kotlin for Forge cannot be jar in jarred. If the player has Kotlin for Forge in the mods folder, and a mod that jar-in-jars Kotlin for Forge, they crash the game with a ResolutionException. |
We have decided to make it work somehow, it might take some time until we have a solution. |
Any updates about this? |
I made a pull request that will fix this issue: #9939 |
Minecraft Version: 1.19
Forge Version: 41.0.98
Logs: https://gist.github.com/thedarkcolour/3c08730917d49a8d1bf79334770b5c0a
Steps to Reproduce:
kotlinforforge-3.7.0-obf.jar
, created inkfflang\build\libs
Description of issue:
This issue happens when running with the vanilla Minecraft launcher. Attempting to load a mod with KotlinForForge (Kotlin language loader) causes an IllegalAccessError, since the
kotlinforforge
module cannot accesskotlin.stdlib
module, which is included via JarJar. The language provider classes are written in Kotlin, and they do not get loaded unless a mod whosemodLoader
is set to "kotlinforforge" in the mods.toml.When KotlinForForge used the shadow plugin to shade the Kotlin libraries, this issue did not happen. It seems like JarJar is not opening up the module-info of the JarJar libraries?
The text was updated successfully, but these errors were encountered: