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
Activity
Robert Scholte
made changes -
Field | Original Value | New Value |
---|---|---|
Status | Open [ 1 ] | Resolved [ 5 ] |
Resolution | Fixed [ 1 ] | |
Assignee | Robert Scholte [ rfscholte ] | |
Fix Version/s | 1.11 [ 16104 ] |
Robert Scholte
made changes -
Status | Resolved [ 5 ] | Reopened [ 4 ] |
Resolution | Fixed [ 1 ] |
Robert Scholte
made changes -
Fix Version/s | 1.11 [ 16104 ] | |
Resolution | Fixed [ 1 ] | |
Fix Version/s | 1.12 [ 16282 ] | |
Status | Reopened [ 4 ] | Resolved [ 5 ] |
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.