diff --git a/src/main/java/org/spongepowered/asm/mixin/injection/At.java b/src/main/java/org/spongepowered/asm/mixin/injection/At.java index 5867395e..824f95e5 100644 --- a/src/main/java/org/spongepowered/asm/mixin/injection/At.java +++ b/src/main/java/org/spongepowered/asm/mixin/injection/At.java @@ -106,10 +106,10 @@ public @interface At { public String[] args() default { }; /** - * Target member used by INVOKE, INVOKE_STRING, INVOKE_ASSIGN and FIELD. - * This must be specified as a fully-qualified member path including - * the class name and signature. Failing to fully-qualify the target member - * will result in an error at obfuscation time. + * Target identifier used by INVOKE, INVOKE_STRING, INVOKE_ASSIGN, FIELD and + * NEW. This must be specified as a fully-qualified member path + * including the class name and signature. Failing to fully-qualify the + * target member will result in an error at obfuscation time. * * @return target reference for supported InjectionPoint types */ diff --git a/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeNew.java b/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeNew.java index 2b75a347..e212cdd6 100644 --- a/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeNew.java +++ b/src/main/java/org/spongepowered/asm/mixin/injection/points/BeforeNew.java @@ -34,6 +34,8 @@ import org.spongepowered.asm.lib.tree.TypeInsnNode; import org.spongepowered.asm.mixin.injection.InjectionPoint; import org.spongepowered.asm.mixin.injection.struct.InjectionPointData; +import com.google.common.base.Strings; + /** *

This injection point searches for NEW opcodes matching its arguments and * returns a list of insns immediately prior to matching instructions. It @@ -51,9 +53,12 @@ import org.spongepowered.asm.mixin.injection.struct.InjectionPointData; * The default value is -1 which supresses ordinal matching * * - *

Example:

+ *

Examples:

*
- *   @At(value = "NEW", args = { "class=java/lang/String" })
+ * @At(value = "NEW", args = "class=java/lang/String") + *
+ *
+ *   @At(value = "NEW", target = "java/lang/String"
*
* *

Note that like all standard injection points, this class matches the insn @@ -77,7 +82,7 @@ public class BeforeNew extends InjectionPoint { public BeforeNew(InjectionPointData data) { this.ordinal = data.getOrdinal(); - this.className = data.get("class", null).replace('.', '/'); + this.className = Strings.emptyToNull(data.get("class", data.get("target", "")).replace('.', '/')); } @Override