From 581c381672610cc522c485890227c27e410365fb Mon Sep 17 00:00:00 2001 From: Mumfrey Date: Tue, 13 Jul 2021 19:33:34 +0100 Subject: [PATCH] This is not a useful behaviour, ignore missing names in SignaturePrinter --- .../java/org/spongepowered/asm/util/SignaturePrinter.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/spongepowered/asm/util/SignaturePrinter.java b/src/main/java/org/spongepowered/asm/util/SignaturePrinter.java index 303a85133..8e64ae984 100644 --- a/src/main/java/org/spongepowered/asm/util/SignaturePrinter.java +++ b/src/main/java/org/spongepowered/asm/util/SignaturePrinter.java @@ -125,10 +125,6 @@ public SignaturePrinter(String name, Type returnType, Type[] argTypes, String[] this.returnType = returnType; this.argTypes = argTypes; this.argNames = argNames; - if (this.argTypes.length > this.argNames.length) { - throw new IllegalArgumentException(String.format("Types array length must not exceed names array length! (names=%d, types=%d)", - this.argNames.length, this.argTypes.length)); - } } /** @@ -225,7 +221,8 @@ private StringBuilder appendArgs(StringBuilder sb, boolean typesOnly, boolean pr } } try { - String name = typesOnly ? null : Strings.isNullOrEmpty(this.argNames[var]) ? "unnamed" + var : this.argNames[var]; + String name = typesOnly ? null : var < this.argNames.length && !Strings.isNullOrEmpty(this.argNames[var]) + ? this.argNames[var] : "unnamed" + var; this.appendType(sb, this.argTypes[var], name); } catch (Exception ex) { // System.err.printf("\n\n>>> argTypes=%d, argNames=%d\n\n", this.argTypes.length, this.argNames.length);