diff --git a/src/agent/java/org/spongepowered/tools/agent/MixinAgent.java b/src/agent/java/org/spongepowered/tools/agent/MixinAgent.java index bb0e7ce3..85132c6f 100644 --- a/src/agent/java/org/spongepowered/tools/agent/MixinAgent.java +++ b/src/agent/java/org/spongepowered/tools/agent/MixinAgent.java @@ -49,7 +49,7 @@ public class MixinAgent implements IHotSwap { * Class file transformer that re-transforms mixin's target classes if the * mixin has been redefined. */ - private class Transformer implements ClassFileTransformer { + class Transformer implements ClassFileTransformer { @Override public byte[] transform(ClassLoader loader, String className, Class classBeingRedefined, ProtectionDomain domain, byte[] classfileBuffer) @@ -110,14 +110,14 @@ public class MixinAgent implements IHotSwap { /** * Class loader used to load mixin classes */ - private static final MixinAgentClassLoader classLoader = new MixinAgentClassLoader(); + static final MixinAgentClassLoader classLoader = new MixinAgentClassLoader(); - private static final Logger logger = LogManager.getLogger("mixin.agent"); + static final Logger logger = LogManager.getLogger("mixin.agent"); /** * Instance used to register the transformer */ - private static Instrumentation instrumentation = null; + static Instrumentation instrumentation = null; /** * Instances of all agents @@ -127,7 +127,7 @@ public class MixinAgent implements IHotSwap { /** * MixinTransformer instance to use to transform the mixin's target classes */ - private final MixinTransformer classTransformer; + final MixinTransformer classTransformer; /** * Constructs an agent from a class transformer in which it will use to diff --git a/src/main/java/org/spongepowered/asm/mixin/transformer/MixinInfo.java b/src/main/java/org/spongepowered/asm/mixin/transformer/MixinInfo.java index b21ffe91..0a8b6c66 100644 --- a/src/main/java/org/spongepowered/asm/mixin/transformer/MixinInfo.java +++ b/src/main/java/org/spongepowered/asm/mixin/transformer/MixinInfo.java @@ -70,6 +70,7 @@ class MixinInfo extends TreeInfo implements Comparable, IMixinInfo { * State that can be reloaded. */ private class ValidationState { + /** * Mixin bytes (read once, generate tree on demand) */ @@ -135,14 +136,15 @@ class MixinInfo extends TreeInfo implements Comparable, IMixinInfo { } private class ReloadedState extends ValidationState { + /** * The previous validation state to compare the changes to */ - final ValidationState parent; + private final ValidationState previous; - ReloadedState(ValidationState parent, byte[] mixinBytes) { - super(mixinBytes, parent.classInfo); - this.parent = parent; + ReloadedState(ValidationState previous, byte[] mixinBytes) { + super(mixinBytes, previous.classInfo); + this.previous = previous; } /** @@ -150,21 +152,21 @@ class MixinInfo extends TreeInfo implements Comparable, IMixinInfo { * only exits while reloading mixins. */ void validateChanges() { - if (!this.syntheticInnerClasses.equals(this.parent.syntheticInnerClasses)) { + if (!this.syntheticInnerClasses.equals(this.previous.syntheticInnerClasses)) { throw new MixinReloadException(MixinInfo.this, "Cannot change inner classes"); } - if (!this.interfaces.equals(this.parent.interfaces)) { + if (!this.interfaces.equals(this.previous.interfaces)) { throw new MixinReloadException(MixinInfo.this, "Cannot change interfaces"); } - if (!new HashSet(this.softImplements).equals(new HashSet(this.parent.softImplements))) { + if (!new HashSet(this.softImplements).equals(new HashSet(this.previous.softImplements))) { throw new MixinReloadException(MixinInfo.this, "Cannot change soft interfaces"); } List targets = MixinInfo.this.readTargetClasses(this.validationClassNode, true); - if (!new HashSet(targets).equals(new HashSet(MixinInfo.this.targetClasses))) { + if (!new HashSet(targets).equals(new HashSet(MixinInfo.this.getTargets0()))) { throw new MixinReloadException(MixinInfo.this, "Cannot change target classes"); } int priority = MixinInfo.this.readPriority(this.validationClassNode); - if (priority != MixinInfo.this.priority) { + if (priority != MixinInfo.this.getPriority()) { throw new MixinReloadException(MixinInfo.this, "Cannot change mixin priority"); } } @@ -293,7 +295,7 @@ class MixinInfo extends TreeInfo implements Comparable, IMixinInfo { * @param suppressPlugin * @return */ - private List readTargetClasses(ClassNode classNode, boolean suppressPlugin) { + protected List readTargetClasses(ClassNode classNode, boolean suppressPlugin) { AnnotationNode mixin = ASMHelper.getInvisibleAnnotation(classNode, Mixin.class); if (mixin == null) { throw new InvalidMixinException(this, String.format("The mixin '%s' is missing an @Mixin annotation", this.className)); @@ -351,7 +353,7 @@ class MixinInfo extends TreeInfo implements Comparable, IMixinInfo { * @param classNode * @return */ - private int readPriority(ClassNode classNode) { + protected int readPriority(ClassNode classNode) { AnnotationNode mixin = ASMHelper.getInvisibleAnnotation(classNode, Mixin.class); if (mixin == null) { throw new InvalidMixinException(this, String.format("The mixin '%s' is missing an @Mixin annotation", this.className)); @@ -580,7 +582,14 @@ class MixinInfo extends TreeInfo implements Comparable, IMixinInfo { * Get the target class list for this mixin */ public List getTargets() { - return Collections.unmodifiableList(this.targetClasses); + return Collections.unmodifiableList(this.getTargets0()); + } + + /** + * Internal method to avoid synthetic bridge generation + */ + protected List getTargets0() { + return this.targetClasses; } /**