Skip to content

ReflectionUtils.findMethod does not find methods for Object.class [SPR-5434] #10108

Closed
@spring-projects-issues

Description

@spring-projects-issues

Daan Kets opened SPR-5434 and commented

ReflectionUtils.findMethod(Class<?> clazz, String methodName) javadoc states:

Attempt to find a Method on the supplied class with the supplied name and no parameters. Searches all superclasses up to Object.

Currently, the implementation does not find any results for methods declared on the Object class. As from the moment when the Object class is reached while searching, the search ends, and no result is returned. So, it's impossible for example to find the public getClass() method using findMethod(<anyObject>,"getClass"). This is pretty inconsistent with the behaviour of for example the 'getAllDeclaredMethods' method, which does return the getClass method as a result.


Affects: 2.5.6

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions