[ https://issues.apache.org/jira/browse/LANG-1782?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18014238#comment-18014238 ]
Seungyong Hong edited comment on LANG-1782 at 8/16/25 3:25 AM: --------------------------------------------------------------- Hi. I'm interesting in this issue. I can't reproduce this case. Here's my code. {code:java} public static class TestBean { public String fooVarArgs(final String... s) { return "fooVarArgs(String...)"; } }{code} {code:java} @Test void temp() { Method fooVarArgs = MethodUtils.getMatchingAccessibleMethod(TestBean.class, "fooVarArgs"); assertNotNull(fooVarArgs); // just passed. } {code} working on * latest master branch. * jdk 17 was (Author: JIRAUSER310736): Hi. I'm interesting in this issue. I can't reproduce this case. Here's my code. {code:java} public static class TestBean { public String fooVarArgs(final String... s) { return "fooVarArgs(String...)"; } }{code} {code:java} @Test void temp() { Method fooVarArgs = MethodUtils.getMatchingAccessibleMethod(TestBean.class, "fooVarArgs"); assertNotNull(fooVarArgs); // just passed. } {code} > getMatchingAccessibleMethod incorrectly returns null if no varargs are > provided > ------------------------------------------------------------------------------- > > Key: LANG-1782 > URL: https://issues.apache.org/jira/browse/LANG-1782 > Project: Commons Lang > Issue Type: Bug > Components: lang.reflect.* > Affects Versions: 3.18.0 > Reporter: Joe Ferner > Priority: Major > > If I have a method > {code:java} > String myFunc(String... args) { ... }{code} > and try to invoke getMatchingAccessibleMethod like this > {code:java} > getMatchingAccessibleMethod(MyClass.class, "myFunc"){code} > the expected return would be myFunc but instead null is received. This > happens because > [https://github.com/apache/commons-lang/blob/master/src/main/java/org/apache/commons/lang3/reflect/MethodUtils.java#L336] > incorrectly assumes at least one vararg type is passed. -- This message was sent by Atlassian Jira (v8.20.10#820010)