Fix FML not handling missing entrypoint classes correctly
Cause was a mismatch in case between the package-name in the class, and actual package location on disk.
We should write a test-case for this regardless:
On-Disk Location:
TEST/Class.class
Package in the class. package test;.
Fixing this particular problem:
[11Apr2025 19:19:09.171] [Render thread/DEBUG] [net.neoforged.fml.javafmlmod.FMLModContainer/LOADING]: Creating FMLModContainer instance for [com.github.Maw326.b2tm.b2tm]
[11Apr2025 19:19:09.175] [Render thread/ERROR] [net.neoforged.fml.javafmlmod.FMLModContainer/LOADING]: Failed to load class com.github.Maw326.b2tm.b2tm
java.lang.NullPointerException: Cannot invoke "java.lang.Class.getName()" because "cls" is null
at MC-BOOTSTRAP/[email protected]/net.neoforged.fml.javafmlmod.FMLModContainer.<init>(FMLModContainer.java:63) ~[loader-6.0.11.jar%23173!/:6.0]
at MC-BOOTSTRAP/[email protected]/net.neoforged.fml.javafmlmod.FMLJavaModLanguageProvider.loadMod(FMLJavaModLanguageProvider.java:37) ~[loader-6.0.11.jar%23173!/:6.0]
at MC-BOOTSTRAP/[email protected]/net.neoforged.fml.ModLoader.buildModContainerFromTOML(ModLoader.java:324) ~[loader-6.0.11.jar%23173!/:6.0]
at MC-BOOTSTRAP/[email protected]/net.neoforged.fml.ModLoader.lambda$buildMods$10(ModLoader.java:311) ~[loader-6.0.11.jar%23173!/:6.0]
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:215) ~[?:?]
at java.base/java.util.AbstractList$RandomAccessSpliterator.forEachRemaining(AbstractList.java:722) ~[?:?]
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:570) ~[?:?]
- [x] Publish PR to GitHub Packages
Last commit published: c643cf743360b09b857585569237eeb4dac703ab.
PR Publishing
The artifacts published by this PR:
- :package:
net.neoforged.fancymodloader:earlydisplay:8.0.8-pr-273-fix-class-not-found - :package:
net.neoforged.fancymodloader:junit-fml:8.0.8-pr-273-fix-class-not-found - :package:
net.neoforged.fancymodloader:loader:8.0.8-pr-273-fix-class-not-found - :package:
net.neoforged.fancymodloader:tests:8.0.8-pr-273-fix-class-not-found
Repository Declaration
In order to use the artifacts published by the PR, add the following repository to your buildscript:
repositories {
maven {
name 'Maven for PR #273' // https://github.com/neoforged/FancyModLoader/pull/273
url 'https://prmaven.neoforged.net/FancyModLoader/pr273'
content {
includeModule('net.neoforged.fancymodloader', 'earlydisplay')
includeModule('net.neoforged.fancymodloader', 'junit-fml')
includeModule('net.neoforged.fancymodloader', 'loader')
includeModule('net.neoforged.fancymodloader', 'tests')
}
}
}
Briefly postponed. We need to check if we use Class.forName correctly in other cases too.
This seems to me like an overabundance of caution,..... But people seem to run into this so yeah LGTM
I've had one user report where they had renamed a class with only a difference in case of the package name (something like myMOD.Main to mymod.Main), for some reason the class-file on disk had the old package-name baked in, leading to very very hard to trace NPEs on startup. This just makes the error reporting in such rare cases better
🚀 This PR has been released as FancyModLoader version 8.0.10.