SpongePowered / Mixin

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

Add logging options for failed Mixin application to MixinPlugins #314

Open gabizou opened 5 years ago

gabizou commented 5 years ago

In investigating https://github.com/SpongePowered/SpongeCommon/issues/2224, the exception is very similar to what ends up causing #313, but I've thought of something additional to be done in cases like this: If the mixin is applied with an associated IMixinConfigPlugin, the plugin can be told of the mixin that failed to apply with the target, much like how it checks currently whether the target mixin should be applied.

In a sense, what this would allow is for some safeguarding against crashes later on if there's other mixing that are being applied in the same "category" so to speak. Of course, if a specific mixin fails to apply and others of the same category did succeed, that'd be something that could cause issues as well, so rolling back those changes wouldn't work, but it would allow still for the associated plugin to report a valid response/message to the server owner to enable/disable some configuration option (this would likely also help us make things like the foam fix block position modifications to be more accurate instead of people having to look up the issue to find the solution).

Mumfrey commented 5 years ago

That's true. Even if you didn't know whether the specific failed mixins were "relevant" to a particular crash, you could include the failed list in crash reports for example.