From 57055a150e59daca338d8e03a6a27ef0a5bfa7e6 Mon Sep 17 00:00:00 2001 From: Mumfrey Date: Sat, 20 Feb 2021 14:40:08 +0000 Subject: [PATCH] Use correct (configured) selector in BeforeInvoke --- .../asm/mixin/injection/points/BeforeInvoke.java | 8 ++++---- .../asm/mixin/injection/points/BeforeStringInvoke.java | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeInvoke.java b/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeInvoke.java index ffb250e4..e47ae8cc 100644 --- a/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeInvoke.java +++ b/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeInvoke.java @@ -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; diff --git a/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeStringInvoke.java b/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeStringInvoke.java index 82318a1c..3f6373d8 100644 --- a/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeStringInvoke.java +++ b/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeStringInvoke.java @@ -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); } }