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
ee32b5e4dc
2 files changed
+22
-12
No files matched your search
@@ -72,8 +72,18 @@ public abstract class InvokeInjector extends Injector {
|
||||
* @param target target
|
||||
*/
|
||||
protected void checkTarget(Target target) {
|
||||
this.checkTargetModifiers(target);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the <tt>static</tt> modifier of the target method matches the
|
||||
* handler
|
||||
*
|
||||
* @param target
|
||||
*/
|
||||
protected final void checkTargetModifiers(Target target) {
|
||||
if (target.isStatic != this.isStatic) {
|
||||
throw new InvalidInjectionException(this.info, "'static' modifier of callback method does not match target in " + this);
|
||||
throw new InvalidInjectionException(this.info, "'static' modifier of handler method does not match target in " + this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,16 +99,18 @@ public abstract class InvokeInjector extends Injector {
|
||||
* @param node Injection location
|
||||
*/
|
||||
protected void checkTargetForNode(Target target, InjectionNode node) {
|
||||
if (!target.isCtor) {
|
||||
return;
|
||||
}
|
||||
|
||||
MethodInsnNode superCall = target.findSuperInitNode();
|
||||
int superCallIndex = target.indexOf(superCall);
|
||||
int targetIndex = target.indexOf(node.getCurrentTarget());
|
||||
if (targetIndex <= superCallIndex && !this.isStatic) {
|
||||
throw new InvalidInjectionException(this.info, "Pre-super " + this.annotationType + " invocation must be static in " + this);
|
||||
if (target.isCtor) {
|
||||
MethodInsnNode superCall = target.findSuperInitNode();
|
||||
int superCallIndex = target.indexOf(superCall);
|
||||
int targetIndex = target.indexOf(node.getCurrentTarget());
|
||||
if (targetIndex <= superCallIndex) {
|
||||
if (!this.isStatic) {
|
||||
throw new InvalidInjectionException(this.info, "Pre-super " + this.annotationType + " invocation must be static in " + this);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
this.checkTargetModifiers(target);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
||||
@@ -231,14 +231,12 @@ public class RedirectInjector extends InvokeInjector {
|
||||
|
||||
if (node.getCurrentTarget() instanceof MethodInsnNode) {
|
||||
this.checkTargetForNode(target, node);
|
||||
super.checkTarget(target);
|
||||
this.injectAtInvoke(target, node);
|
||||
return;
|
||||
}
|
||||
|
||||
if (node.getCurrentTarget() instanceof FieldInsnNode) {
|
||||
this.checkTargetForNode(target, node);
|
||||
super.checkTarget(target);
|
||||
this.injectAtFieldAccess(target, node);
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user