diff --git a/src/main/java/org/spongepowered/asm/mixin/injection/invoke/InvokeInjector.java b/src/main/java/org/spongepowered/asm/mixin/injection/invoke/InvokeInjector.java index 23d5d651..299c3b5a 100644 --- a/src/main/java/org/spongepowered/asm/mixin/injection/invoke/InvokeInjector.java +++ b/src/main/java/org/spongepowered/asm/mixin/injection/invoke/InvokeInjector.java @@ -63,7 +63,15 @@ public abstract class InvokeInjector extends Injector { @Override protected void sanityCheck(Target target, List injectionPoints) { super.sanityCheck(target, injectionPoints); - + this.checkTarget(target); + } + + /** + * Sanity checks on target + * + * @param target target + */ + protected void checkTarget(Target target) { if (target.isStatic != this.isStatic) { throw new InvalidInjectionException(this.info, "'static' modifier of callback method does not match target in " + this); } diff --git a/src/main/java/org/spongepowered/asm/mixin/injection/invoke/ModifyArgInjector.java b/src/main/java/org/spongepowered/asm/mixin/injection/invoke/ModifyArgInjector.java index 419b9b72..6bff31d0 100644 --- a/src/main/java/org/spongepowered/asm/mixin/injection/invoke/ModifyArgInjector.java +++ b/src/main/java/org/spongepowered/asm/mixin/injection/invoke/ModifyArgInjector.java @@ -83,6 +83,17 @@ public class ModifyArgInjector extends InvokeInjector { } } + /* (non-Javadoc) + * @see org.spongepowered.asm.mixin.injection.invoke.InvokeInjector + * #checkTarget(org.spongepowered.asm.mixin.injection.struct.Target) + */ + @Override + protected void checkTarget(Target target) { + if (!this.isStatic && target.isStatic) { + throw new InvalidInjectionException(this.info, "non-static callback method " + this + " targets a static method which is not supported"); + } + } + /** * Do the injection */