The new ParameterNames.getSumOfArgumentSizes method counts double when a parameter is a non array reference type, because, when the code finds the ';' character, it does not increase 'i' again after the loop, causing the main loop to read it again and treat it as another parameter.
The following call, will reproduce the bug:
ParameterNames.registerName("A", PUBLIC, "m1", "(Ljava/lang/String;)", "J", "local", 2);
I also believe that the case for the array would not properly handle arrays of reference types.
I suggest using the following implementation:
private static int getSumOfArgumentSizes(@Nonnull String memberDesc)
{
int sum = 0;
int i = 1;
while (true) {
char c = memberDesc.charAt(i);
if (c == ')') {
return sum;
}
if (c == 'L') {
while (memberDesc.charAt(i) != ';') i++;
sum++;
}
else if (c == '[') {
while ((c = memberDesc.charAt(i)) == '[') i++;
continue;
}
else if (isDoubleSizeType(c)) {
sum += 2;
}
else {
sum++;
}
i++;
}
}