SpongePowered / Mixin

Mixin is a trait/mixin and bytecode weaving framework for Java using ASM
MIT License
1.37k stars 185 forks source link

Can't mixin into ClassLoader? #637

Closed kropt closed 11 months ago

kropt commented 11 months ago

I'm not entirely sure if this is intended behaviour, but whatever I do, mixins for any ClassLoader just don't get applied. No errors or logs suggesting anything went wrong. Class doesn't get dumped with -Dmixin.debug.export=true. Mixin just doesn't do anything.

@Mixin(value = ClassLoader.class, remap = false)
public abstract class ClassLoaderMixin {
    // ...
}

Mixin is in correct package and listed in *.mixins.json. Feels like I've tried everything, and nothing I do can get a mixin to apply to a ClassLoader. The only possible issue I can think of is Jigsaw being funny about java.lang.ClassLoader? I have a method to disable that, but I don't know how I can run it before mixins are applied.

kropt commented 11 months ago

Targetting Fabric/Quilt if that matters.

LlamaLad7 commented 11 months ago

You cannot mix into classes that are already loaded. ClassLoader is obviously one of the first classes to load in any application. You should have no reason to do that in the first place, but regardless this is an issue tracker, not a support forum. Take it to the fabric / quilt discord with your actual problem, since you obviously cannot modify the classloader.

kropt commented 11 months ago

Fair enough, guess I'm out of luck then.