Skip to content

Commit

Permalink
Draft fix for varargs in jdt
Browse files Browse the repository at this point in the history
  • Loading branch information
niloc132 committed Jun 19, 2024
1 parent 33b0dd2 commit 54cf49b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions dev/core/src/com/google/gwt/dev/jjs/impl/GwtAstBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -3256,13 +3256,13 @@ private List<JExpression> popCallArguments(SourceInfo info, Expression[] argumen
List<JExpression> args = pop(arguments);
for (int i = 0; i < args.size(); i++) {
// Account for varargs parameter.
int parameterIndex = Math.min(i, methodBinding.parameters.length - 1);
int parameterIndex = Math.min(i, methodBinding.original().parameters.length - 1);
args.set(i, maybeBoxOrUnbox(
args.get(i),
arguments[i].implicitConversion,
isDoNotAutoBoxParameter(methodBinding, parameterIndex)));
}
if (!methodBinding.isVarargs()) {
if (!methodBinding.original().isVarargs()) {
return args;
}

Expand All @@ -3272,7 +3272,8 @@ private List<JExpression> popCallArguments(SourceInfo info, Expression[] argumen
args = Lists.newArrayListWithCapacity(1);
}

TypeBinding[] params = methodBinding.parameters;
TypeBinding[] params = methodBinding.isVarargs() ? methodBinding.parameters :
methodBinding.original().parameters;
int varArg = params.length - 1;

// See if there's a single varArg which is already an array.
Expand Down

0 comments on commit 54cf49b

Please sign in to comment.