Mixin
Mixin copied to clipboard
Mixin hotswapping broken in modlauncher
Trying to hotswap changes to almost any mixin causes an exception like this, causing hotswap to fail:
[21:22:25] [JDWP Transport Listener: dt_socket/ERROR] [mi.agent/]: Error while re-transforming target class net/minecraft/world/chunk/listener/TrackingChunkStatusListener
java.lang.UnsupportedOperationException: class redefinition failed: attempted to change superclass or interfaces
at sun.instrument.InstrumentationImpl.redefineClasses0(Native Method) ~[?:1.8.0_242] {}
at sun.instrument.InstrumentationImpl.redefineClasses(InstrumentationImpl.java:170) ~[?:1.8.0_242] {}
at org.spongepowered.tools.agent.MixinAgent$Transformer.reApplyMixins(MixinAgent.java:121) [mixin-0.8.jar:0.8+unknown-b0.git-unknown] {}
at org.spongepowered.tools.agent.MixinAgent$Transformer.transform(MixinAgent.java:72) [mixin-0.8.jar:0.8+unknown-b0.git-unknown] {}
at sun.instrument.TransformerManager.transform(TransformerManager.java:188) [?:1.8.0_242] {}
at sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:428) [?:1.8.0_242] {}
This can sometimes cause different kinds of errors, including some vanilla class failing to initialize.
I think the root cause of this is ModLauncherClassProvider using Thread.currentThread().getContextClassLoader() which is NOT going to be the modlauncher classloader on the instrumentation thread, so it's trying to redefine the wrong class.
Ok I'll look into that.