FancyModLoader icon indicating copy to clipboard operation
FancyModLoader copied to clipboard

Fix FML not handling missing entrypoint classes correctly

Open shartte opened this issue 8 months ago • 1 comments

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) ~[?:?]

shartte avatar Apr 11 '25 18:04 shartte

  • [x] Publish PR to GitHub Packages

Last commit published: c643cf743360b09b857585569237eeb4dac703ab.

PR Publishing

The artifacts published by this PR:

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.

shartte avatar Jun 17 '25 22:06 shartte

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

shartte avatar Jun 22 '25 10:06 shartte

🚀 This PR has been released as FancyModLoader version 8.0.10.

neoforged-releases[bot] avatar Jun 22 '25 10:06 neoforged-releases[bot]