AmarGhugare opened a new pull request, #1881:
URL: https://github.com/apache/commons-lang/pull/1881

   `MethodUtils.invokeStaticMethod` can select an instance method even when a 
compatible static overload exists. For example, given instance 
`choose(Integer)` and static `choose(Number)`, an Integer argument selects the 
instance method and fails with `NullPointerException` because the receiver is 
null.
   
   Filter static invocation candidates before overload selection, including the 
exact-match fast path. This allows compatible static overloads to be selected 
without changing ordinary instance-method resolution. When only an instance 
method matches, both static invocation variants report `NoSuchMethodException`; 
exact invocation still requires an exact parameter signature. No public API is 
added.
   
   Regressions cover inferred and explicit parameter types, primitive widening, 
varargs, inherited static methods, instance-only methods, and unchanged 
instance overload selection. All three new test methods fail before the fix.
   
   Validation: 88 focused reflection tests and Checkstyle pass. Full default 
Maven validation: 118160 tests, zero failures/errors, 29 skipped; coverage, 
license, Checkstyle, binary compatibility, SpotBugs, PMD, and Javadoc checks 
pass.
   
   Reproduced in 3.22.0 and current master. Jira filing is pending account 
approval.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to