Skip to content

Commit

Permalink
var arg support
Browse files Browse the repository at this point in the history
  • Loading branch information
ZZZank committed Apr 7, 2024
1 parent e8dfb4a commit 8331731
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ public String formatParams(Map<String, String> renames, boolean forceNoUnderscor
? modifiers.get(nameRaw).transform(typeTransformer)
: formatParamUnderscore(pInfo.getType(), forceNoUnderscore);
return String.format(
"%s: %s",
"%s%s: %s",
pInfo.isVarArgs() ? "..." : "",
NameResolver.getNameSafe(renames.getOrDefault(nameRaw, nameRaw)),
paramType
);
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/com/probejs/info/MethodInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,12 @@ public static class ParamInfo {

private final String name;
private ITypeInfo type;
private final boolean isVarArgs;

public ParamInfo(Parameter parameter) {
this.name = parameter.getName();
this.type = TypeInfoResolver.resolveType(parameter.getParameterizedType());
this.isVarArgs = parameter.isVarArgs();
}

public String getName() {
Expand All @@ -108,6 +110,10 @@ public ITypeInfo getType() {
return type;
}

public boolean isVarArgs() {
return isVarArgs;
}

public void setTypeInfo(ITypeInfo type) {
this.type = type;
}
Expand Down

0 comments on commit 8331731

Please sign in to comment.