GitHub user Derek-Ashmore opened a pull request:
https://github.com/apache/commons-lang/pull/141
Lang 1195: Enhance MethodUtils to allow invocation of private methods
Currently, MethodUtils is restricted to finding and invoking accessible
methods. Frequently, developers have a need to test 'private' methods. What I
see is that they escalate access to 'protected' in order to more easily provide
test coverage for these methods. From a design perspective, this is bad.
I propose to enhance MethodUtils so that it can easily invoke private
methods. I'm not suggesting that developers should do this in production code,
merely test code. Much as FieldUtils provides access to private fields via the
'forceAccess' overload on many of its methods. I've copied a utility like this
around for years. It would be much more convenient to simply include it with
Commons Lang. See [LANG-1195](https://issues.apache.org/jira/browse/LANG-1195)
for details.
I made sure that I used space indentation and tried to adhere closely to
your standards. I've also signed the Contributor License Agreement.
Assuming you like the enhancement, I'm willing to contribute additional
work if you see issues with what I've done.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/Force66/commons-lang LANG-1195
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/commons-lang/pull/141.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #141
----
commit f53fb65535232962ccd35ba9ad66e2e4c248f92e
Author: Derek Ashmore <[email protected]>
Date: 2016-01-01T14:31:47Z
See LANG-1195; Enhance MethodUtils to allow invocation of private
methods
commit 4a256e62529fbc57dfb55a99e222ec3591cee7ec
Author: Derek Ashmore <[email protected]>
Date: 2016-05-13T09:42:32Z
See LANG-1195; Removed accidental tab indentation
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---