You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Benedikt Ritter (JIRA)" <ji...@apache.org> on 2015/04/18 20:36:59 UTC

[jira] [Commented] (LANG-1115) Add support for varargs in ConstructorUtils, MemberUtils, and MethodUtils

    [ https://issues.apache.org/jira/browse/LANG-1115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14501515#comment-14501515 ] 

Benedikt Ritter commented on LANG-1115:
---------------------------------------

Hello [~joeferner],

very nice and useful patch. I've looked through the code and here are my findings:
* ConstructorUtilsTest currently doesn't check whether the right arguments were passed to the invoked constructor of TestBean. However for a constructor taking varagrs, I think we should assign the passed in varargs array and compare it to what we passed in.
* In MemberUtils there is a long comment at the start of {{float getTotalTransformationCost(final Class<?>[] srcArgs, final Class<?>[] destArgs, boolean isVarArgs)}}. How about making this information explicit by assigning boolean values like {{boolean noVarArgsPassed = src.length + 1 == dest.length}}.
* Furthermore in MemberUtils, I'm not sure I like the {{isVarArgs}} flag. I think I would rather linke to have two separate methods.
* Can you please explain what {{Object[] getVarArgs(Object[] args, Class<?>[] methodParameterTypes)}} int MethodUtils exactly does? I don't understand the code :)
* Checking input varargs arguments would be good in MethodUtilsTest

Thank you!

> Add support for varargs in ConstructorUtils, MemberUtils, and MethodUtils
> -------------------------------------------------------------------------
>
>                 Key: LANG-1115
>                 URL: https://issues.apache.org/jira/browse/LANG-1115
>             Project: Commons Lang
>          Issue Type: Improvement
>          Components: lang.reflect.*
>            Reporter: Joe Ferner
>            Priority: Minor
>             Fix For: Review Patch
>
>         Attachments: LANG-1115.patch
>
>
> Currently when calling methods such as MethodUtils.getMatchingAccessibleMethod variable arguments are not supported. It would be nice if by calling getMatchingAccessibleMethod with arguments that the java compiler would normally match with a vararg method would be matched.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)