mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-18 12:39:12 +00:00
Add debugging option for running CheckClassAdapter
This commit is contained in:
1 parent
e88f5b72ee
commit
76a37fc412
1 file changed
+8
@@ -43,6 +43,7 @@ import org.apache.commons.io.FileUtils;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.core.helpers.Booleans;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
import org.objectweb.asm.Opcodes;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
@@ -54,6 +55,7 @@ import org.objectweb.asm.tree.LabelNode;
|
||||
import org.objectweb.asm.tree.LineNumberNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import org.objectweb.asm.util.CheckClassAdapter;
|
||||
import org.spongepowered.asm.mixin.InvalidMixinException;
|
||||
import org.spongepowered.asm.mixin.MixinEnvironment;
|
||||
import org.spongepowered.asm.mixin.MixinTransformerError;
|
||||
@@ -160,6 +162,7 @@ public class MixinTransformer extends TreeTransformer {
|
||||
|
||||
public static final boolean DEBUG_ALL = Booleans.parseBoolean(System.getProperty("mixin.debug"), false);
|
||||
private static final boolean DEBUG_EXPORT = Booleans.parseBoolean(System.getProperty("mixin.debug.export"), false) | MixinTransformer.DEBUG_ALL;
|
||||
private static final boolean DEBUG_VERIFY = Booleans.parseBoolean(System.getProperty("mixin.debug.verify"), false) | MixinTransformer.DEBUG_ALL;
|
||||
|
||||
/**
|
||||
* Log all the things
|
||||
@@ -356,6 +359,11 @@ public class MixinTransformer extends TreeTransformer {
|
||||
// Extension point
|
||||
this.postTransform(transformedName, targetClass, mixins);
|
||||
|
||||
// Run CheckClassAdapter on the mixin bytecode if debug option is enabled
|
||||
if (MixinTransformer.DEBUG_VERIFY) {
|
||||
targetClass.accept(new CheckClassAdapter(new ClassWriter(ClassWriter.COMPUTE_FRAMES)));
|
||||
}
|
||||
|
||||
// Collapse tree to bytes
|
||||
byte[] bytes = this.writeClass(targetClass);
|
||||
|
||||
|
||||
Reference in new issue
Block a user