mirror of
https://github.com/LegacyModdingMC/UniMix.git
synced 2026-11-20 11:09:35 +00:00
Merge branch 'master' into 0.7_dev
This commit is contained in:
commit
e5a20abf65
3 files changed
+12
-8
No files matched your search
@@ -72,18 +72,22 @@ public abstract class InvokeInjector extends Injector {
|
||||
* @param target target
|
||||
*/
|
||||
protected void checkTarget(Target target) {
|
||||
this.checkTargetModifiers(target);
|
||||
this.checkTargetModifiers(target, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the <tt>static</tt> modifier of the target method matches the
|
||||
* handler
|
||||
*
|
||||
* @param target
|
||||
* @param target Target to check
|
||||
* @param exactMatch True if static must match, false to only check if an
|
||||
* instance handler is targetting a static method
|
||||
*/
|
||||
protected final void checkTargetModifiers(Target target) {
|
||||
if (target.isStatic != this.isStatic) {
|
||||
protected final void checkTargetModifiers(Target target, boolean exactMatch) {
|
||||
if (exactMatch && target.isStatic != this.isStatic) {
|
||||
throw new InvalidInjectionException(this.info, "'static' modifier of handler method does not match target in " + this);
|
||||
} else if (!exactMatch && !this.isStatic && target.isStatic) {
|
||||
throw new InvalidInjectionException(this.info, "non-static callback method " + this + " targets a static method which is not supported");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +114,7 @@ public abstract class InvokeInjector extends Injector {
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.checkTargetModifiers(target);
|
||||
this.checkTargetModifiers(target, true);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
@@ -56,9 +56,7 @@ public class ModifyArgsInjector extends InvokeInjector {
|
||||
*/
|
||||
@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");
|
||||
}
|
||||
this.checkTargetModifiers(target, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -67,11 +67,13 @@ public class ModifyConstantInjector extends RedirectInjector {
|
||||
|
||||
AbstractInsnNode targetNode = node.getCurrentTarget();
|
||||
if (targetNode instanceof JumpInsnNode) {
|
||||
this.checkTargetModifiers(target, false);
|
||||
this.injectExpandedConstantModifier(target, (JumpInsnNode)targetNode);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Bytecode.isConstant(targetNode)) {
|
||||
this.checkTargetModifiers(target, false);
|
||||
this.injectConstantModifier(target, targetNode);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user