[
http://jira.codehaus.org/browse/QDOX-201?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=211624#action_211624
]
Robert Scholte commented on QDOX-201:
-------------------------------------
Funny, this morning I had a look to see if I missed some bugs and I noticed I
still had to solve this one :)
I've tried to work things out, but in the end I didn't like to solve this by
changing Type to support varargs. It's just not the right place, it's
JavaParameter vs. JavaClass/Type.
So I came up with another idea. Vararg says actually something about the
method, why not solve it there? This way we're not hacking around, code
adjustments are pretty straightforward.
Only one thing: getMethodBySignature(String name, Type[] types, boolean varArg)
isn't possible, the signature is already in use where the boolean stands for
'useSuperclass'.
Another methodname is required. getVarargMethodBySignature is an option, but
maybe it's better to try to keep this methods close to eachother by name like
'getMethod......', so it's easier for developers to recognize both methods.
Anybody any thoughts?
> Method Resolution incorrect for methods with vararg-parameters
> --------------------------------------------------------------
>
> Key: QDOX-201
> URL: http://jira.codehaus.org/browse/QDOX-201
> Project: QDox
> Issue Type: Bug
> Components: Java API
> Affects Versions: 1.10.1
> Environment: Tested with Snapshot of QDox 1.11 from 2010-01-10
> Reporter: Sam Bernet
> Attachments: TestQdoxVarArgsResolution.java
>
>
> 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:
> {noformat}
> 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
> {noformat}
> Result:
> {noformat}
> 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?!
> {noformat}
> See attached test-case for a complete illustration of the problem, including
> a working JUnit-Test
> Best regards,
> Sam Bernet
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
---------------------------------------------------------------------
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email