Details
Description
I suspect the method JavaParameter#getType()to give incorrect results for vararg-parameters, resulting in JavaClass#getMethodBySignature(String, Type[]) failing to correctly lookup existing methods.
getType() seems to just return the base type of a varargs-parameter. IMHO opinion the correct behaviour would be to return the corresponding array-type with dimension 1.
Example:
class Test {
method(String... param) {} // getType() returns Type 'String' instead of 'String[]'
method(String param) {} // getType() returns Type 'String' as well, so there's no way to distuingish the two methods
Result:
getMethodBySignature('method', new Type[] {new Type('String', 1)}) -> returns null
getMethodBySignature('method', new Type[] {new Type('String')}) -> returns first method
-> no way to retrieve second method at all?!
See attached test-case for a complete illustration of the problem, including a working JUnit-Test
Best regards,
Sam Bernet
I think we can keep the model cleaner if we avoid a translation from the triple dots to a dimension. Right now I'm thinking of a new constructor, where you can set a varargs boolean. This way the signature is much easier to recognize.