Skip to content

Restore preference for interface (most abstract) method in getPubliclyAccessibleMethodIfPossible #35189

@jhoeller

Description

@jhoeller

With the introduction of ClassUtils.getPubliclyAccessibleMethodIfPossible in #33216, there is a subtle regression caused for code that previously used getInterfaceMethodIfPossible: If the present type is public already, it will always use the given method as-is. Whereas previously, it would prefer the interface method over a method in a public class which does help for a wide range of Java Platform Module System scenarios.

On a similar note, the algorithm in getPubliclyAccessibleMethodIfPossible prefers the most concrete method it can find in a public type which should ideally align with the preference for abstractness through getInterfaceMethodIfPossible, preferring the highest-possible match in the type hierarchy instead. This covers even more scenarios with the Java Platform Module System where the lower implementation types might not be exported.

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)type: regressionA bug that is also a regression

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions