[
https://issues.apache.org/jira/browse/LANG-1778?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gary D. Gregory updated LANG-1778:
----------------------------------
Summary: MethodUtils.getMatchingMethod() doesn't respect the order of
methods (was: MethodUtils.getMatchingMethod doesn't respect the order of
methods)
> MethodUtils.getMatchingMethod() doesn't respect the order 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
>
> 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)