Skip to content

bug: DebugType enum patch prevents other mods from extending it #25

Open

Description

@Electrisoma

When you attempt to write an enum extension using ClassTweaker into the DebugType enum, the newly extended enum entry conflicts with Leaf's own extension.
Like for example,

A ClassTweaker like this:

classTweaker v2 official

transitive-extend-enum zombie/debug/DebugType LibTest

And a Mixin like this:

@Mixin(DebugType.class)
enum DebugTypeMixin {
    LibTest();

    @Shadow
    DebugTypeMixin(DebugType... alsoActivate) {}
}

Will result in this crash:

Zomboid has crashed!
dev.aoqia.leaf.loader.impl.FormattedException: java.lang.ExceptionInInitializerError
	at dev.aoqia.leaf.loader.impl.FormattedException.ofLocalized(FormattedException.java:63)
	at dev.aoqia.leaf.loader.impl.game.zomboid.ZomboidGameProvider.launch(ZomboidGameProvider.java:481)
	at dev.aoqia.leaf.loader.impl.launch.knot.Knot.launch(Knot.java:72)
	at dev.aoqia.leaf.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
	at net.fabricmc.devlaunchinjector.Main.main(Main.java:86)
Caused by: java.lang.ExceptionInInitializerError
	at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
	at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1169)
	at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.ensureClassInitialized(MethodHandleAccessorFactory.java:341)
	at java.base/jdk.internal.reflect.MethodHandleAccessorFactory.newConstructorAccessor(MethodHandleAccessorFactory.java:104)
	at java.base/jdk.internal.reflect.ReflectionFactory.newConstructorAccessor(ReflectionFactory.java:138)
	at java.base/java.lang.reflect.Constructor.acquireConstructorAccessor(Constructor.java:546)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:496)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:483)
	at dev.aoqia.leaf.loader.impl.game.zomboid.ZomboidGameProvider.setupLogHandler(ZomboidGameProvider.java:389)
	at dev.aoqia.leaf.loader.impl.game.zomboid.Hooks.setupLogHandler(Hooks.java:74)
	at knot//zombie.gameStates.MainScreenState.main(MainScreenState.java:192)
	at dev.aoqia.leaf.loader.impl.game.zomboid.ZomboidGameProvider.launch(ZomboidGameProvider.java:479)
	... 3 more
Caused by: dev.aoqia.leaf.loader.impl.FormattedException: java.lang.reflect.InvocationTargetException
	at knot//dev.aoqia.leaf.loader.impl.game.zomboid.ZomboidLogHandler.<clinit>(ZomboidLogHandler.java:84)
	... 15 more
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:116)
	at java.base/java.lang.reflect.Method.invoke(Method.java:565)
	at knot//dev.aoqia.leaf.loader.impl.game.zomboid.ZomboidLogHandler.<clinit>(ZomboidLogHandler.java:64)
	... 15 more
Caused by: java.lang.NullPointerException: Cannot invoke "java.lang.Enum.name()" because "constant" is null
	at java.base/java.lang.Class.enumConstantDirectory(Class.java:3468)
	at java.base/java.lang.Enum.valueOf(Enum.java:287)
	at knot//zombie.debug.DebugType.valueOf(DebugType.java:8)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	... 17 more

Activity

  1. added this to the v1.8.0 milestone on Oct 6, 2026
  2. self-assigned this
    on Oct 6, 2026
  3. added and removed
    priority/mediumCan wait a while without impacting other things
    on Oct 14, 2026
  4. moved this from todo to in progress in Globalon Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

  • Status
    in progress

Relationships

None yet

Development

No branches or pull requests

Issue actions