Revise staticness sanity check for ModifyArg injector

This commit is contained in:
Mumfrey committed 2016-05-20 03:24:10 +01:00
1 parent b6e7436d35
commit 36b4392576
2 files changed
+20 -1

No files matched your search

@@ -63,7 +63,15 @@ public abstract class InvokeInjector extends Injector {
@Override
protected void sanityCheck(Target target, List<InjectionPoint> 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);
}
@@ -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
*/