mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-21 20:52:29 +00:00
Revise staticness sanity check for ModifyArg injector
This commit is contained in:
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
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user