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

Gary D. Gregory edited comment on LANG-1778 at 7/17/25 4:34 PM:
----------------------------------------------------------------

Thank you [~wollew] for the report.

PR applied to git master and 3.18.1-SNAPSHOT builds from 
[https://repository.apache.org/content/repositories/snapshots/]

Please verify your use case and close this ticket if appropriate.

G


was (Author: garydgregory):
Thank you [~wollew] for the report.

PR applied to git master and 33.18.1-SNAPSHOT builds from 
[https://repository.apache.org/content/repositories/snapshots/]

Please verify your use case and close this ticket if appropriate.

G

> MethodUtils.getMatchingMethod() doesn't respect the hierarchy of methods
> ------------------------------------------------------------------------
>
>                 Key: LANG-1778
>                 URL: https://issues.apache.org/jira/browse/LANG-1778
>             Project: Commons Lang
>          Issue Type: Bug
>          Components: lang.*
>    Affects Versions: 3.18.0
>            Reporter: Wolfgang Wachsmuth
>            Priority: Major
>             Fix For: 3.18.1
>
>
> The fix of LANG-1754 created a new issue.
> I isolated the isse
>  
> {code:java}
> import java.lang.annotation.Documented;
> import java.lang.annotation.ElementType;
> import java.lang.annotation.Retention;
> import java.lang.annotation.RetentionPolicy;
> import java.lang.annotation.Target;
> import org.apache.commons.lang3.reflect.MethodUtils;
> class Scratch {
>     @Documented
>     @Target({ElementType.METHOD})
>     @Retention(RetentionPolicy.RUNTIME)
>     public @interface MyAnnotation {
>     }
>     public interface Test {
>         void hello();
>     }
>     public static abstract class MyAbstractClass implements Test {
>         @MyAnnotation
>         public void hello() {}
>     }
>     public static class MyConcreteClass extends MyAbstractClass {}
>     public static void main(String[] args) {
>         assert MethodUtils.getMatchingMethod(MyConcreteClass.class, 
> "hello").isAnnotationPresent(MyAnnotation.class);
>     }
> } {code}
> getMatchingMethod SHOULD find MyAbstractClass#hello but it finds Test#hello
> This is a somehow severe issue because it's breaking existing implementations 
> using commons-lang3



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to