From ee0c879dc7c3d16c82d77be69f3d3faad106310d Mon Sep 17 00:00:00 2001 From: Mumfrey Date: Wed, 2 Aug 2017 19:01:56 +0100 Subject: [PATCH] Add refmap status in a couple of other useful spots --- .../asm/mixin/injection/struct/InjectionInfo.java | 11 ++++++----- .../asm/mixin/refmap/ReferenceMapper.java | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/spongepowered/asm/mixin/injection/struct/InjectionInfo.java b/src/main/java/org/spongepowered/asm/mixin/injection/struct/InjectionInfo.java index 9f879480..1df288bd 100644 --- a/src/main/java/org/spongepowered/asm/mixin/injection/struct/InjectionInfo.java +++ b/src/main/java/org/spongepowered/asm/mixin/injection/struct/InjectionInfo.java @@ -273,14 +273,15 @@ public abstract class InjectionInfo extends SpecialMethodInfo implements ISliceC this.classNode.methods.add(method); } + String refMapStatus = this.mixin.getReferenceMapper().getStatus(); if ((MixinEnvironment.getCurrentEnvironment().getOption(Option.DEBUG_INJECTORS) && this.injectedCallbackCount < this.expectedCallbackCount)) { throw new InvalidInjectionException(this, - String.format("Injection validation failed: %s %s%s in %s expected %d invocation(s) but %d succeeded", - this.getDescription(), this.method.name, this.method.desc, this.mixin, this.expectedCallbackCount, this.injectedCallbackCount)); + String.format("Injection validation failed: %s %s%s in %s expected %d invocation(s) but %d succeeded. %s", this.getDescription(), + this.method.name, this.method.desc, this.mixin, this.expectedCallbackCount, this.injectedCallbackCount, refMapStatus)); } else if (this.injectedCallbackCount < this.requiredCallbackCount) { throw new InjectionError( - String.format("Critical injection failure: %s %s%s in %s failed injection check, (%d/%d) succeeded", - this.getDescription(), this.method.name, this.method.desc, this.mixin, this.injectedCallbackCount, this.requiredCallbackCount)); + String.format("Critical injection failure: %s %s%s in %s failed injection check, (%d/%d) succeeded. %s", this.getDescription(), + this.method.name, this.method.desc, this.mixin, this.injectedCallbackCount, this.requiredCallbackCount, refMapStatus)); } else if (this.injectedCallbackCount > this.maxCallbackCount) { throw new InjectionError( String.format("Critical injection failure: %s %s%s in %s failed injection check, %d succeeded of %d allowed", @@ -398,7 +399,7 @@ public abstract class InjectionInfo extends SpecialMethodInfo implements ISliceC if (this.targets.size() == 0) { throw new InvalidInjectionException(this, type + " annotation on " + this.method.name + " could not find any targets matching " - + InjectionInfo.namesOf(searchFor)); + + InjectionInfo.namesOf(searchFor) + ". " + this.mixin.getReferenceMapper().getStatus()); } } diff --git a/src/main/java/org/spongepowered/asm/mixin/refmap/ReferenceMapper.java b/src/main/java/org/spongepowered/asm/mixin/refmap/ReferenceMapper.java index 998d52c8..4127067f 100644 --- a/src/main/java/org/spongepowered/asm/mixin/refmap/ReferenceMapper.java +++ b/src/main/java/org/spongepowered/asm/mixin/refmap/ReferenceMapper.java @@ -144,7 +144,7 @@ public final class ReferenceMapper implements Serializable { * @return status message */ public String getStatus() { - return this.isDefault() ? "No refMap loaded" : "Using refmap " + this.getResourceName(); + return this.isDefault() ? "No refMap loaded." : "Using refmap " + this.getResourceName(); } /**