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.