Use correct (configured) selector in BeforeInvoke

This commit is contained in:
Mumfrey committed 2021-02-20 14:40:08 +00:00
1 parent b5200b0537
commit 57055a150e
2 files changed
+6 -6

No files matched your search

@@ -198,7 +198,7 @@ public class BeforeInvoke extends InjectionPoint {
if (target.match(insn).isExactMatch()) {
this.log("{}->{} > found a matching insn, checking preconditions...", this.context, this.className);
if (++matchCount > selector.getMaxMatchCount()) {
if (++matchCount > target.getMaxMatchCount()) {
break;
}
@@ -222,9 +222,9 @@ public class BeforeInvoke extends InjectionPoint {
+ "To inhibit permissive search set mixin.env.allowPermissiveMatch=false", this.className, selector, this.mixin, found);
}
if (matchCount < selector.getMinMatchCount()) {
throw new SelectorConstraintException(selector, String.format("%s did not match the required number of targets (required=%d, matched=%d)",
selector, selector.getMinMatchCount(), matchCount));
if (matchCount < target.getMinMatchCount()) {
throw new SelectorConstraintException(target, String.format("%s did not match the required number of targets (required=%d, matched=%d)",
target, selector.getMinMatchCount(), matchCount));
}
return found > 0;
@@ -122,7 +122,7 @@ public class BeforeStringInvoke extends BeforeInvoke {
if (insn instanceof LdcInsnNode) {
LdcInsnNode node = (LdcInsnNode) insn;
if (node.cst instanceof String && this.ldcValue.equals(node.cst)) {
this.log("{} > found a matching LDC with value {}", this.className, node.cst);
this.log("{}->{} > found a matching LDC with value {}", this.context, this.className, node.cst);
this.foundLdc = true;
return;
}
@@ -133,7 +133,7 @@ public class BeforeStringInvoke extends BeforeInvoke {
@Override
protected boolean matchesOrdinal(int ordinal) {
this.log("{} > > found LDC \"{}\" = {}", this.className, this.ldcValue, this.foundLdc);
this.log("{}->{} > > found LDC \"{}\" = {}", this.context, this.className, this.ldcValue, this.foundLdc);
return this.foundLdc && super.matchesOrdinal(ordinal);
}
}