Skip to content

Commit

Permalink
This is not a useful behaviour, ignore missing names in SignaturePrinter
Browse files Browse the repository at this point in the history
  • Loading branch information
Mumfrey committed Jul 13, 2021
1 parent b0cd24b commit 581c381
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

/**
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 581c381

Please sign in to comment.