inconsistency between Class.getMethod and Class.getMethods Was: Loading classes with many methods is very expensive
joel.franck at oracle.com
Wed Oct 29 19:25:04 UTC 2014
On 29 Oct 2014, at 18:16, Peter Levart <peter.levart at gmail.com> wrote:
> On 10/29/2014 02:08 PM, Joel Borggrén-Franck wrote:
>> Hi Peter,
>> I’m not entirely convinced this is a bug.
>> The lookup order for getMethod has for a long time been walk up superclasses and return what you find there first without even looking at interfaces. It might be desirable to change that but I’m not sure.
> Hi Joel,
> It has been for a long time like that as you say, but for a long time Java did not have default methods. It's unexpected for getMethod() to return a method that is not contained in getMethods() result.
> Anyway, I have created a bug to track this:
Thanks. For the record I don’t necessarily disagree, I just haven’t had time to research this yet. I think this is a subset of https://bugs.openjdk.java.net/browse/JDK-8029459 but might also be worth changing separately in 9. If it is a bug, it might not be worth fixing in 8u.
More information about the core-libs-dev