JDK 8 code review request for 8005042 Add Method.isDefault to core reflection
joe.darcy at oracle.com
Wed Dec 19 00:24:59 UTC 2012
On 12/18/2012 04:20 PM, David Holmes wrote:
> On 19/12/2012 10:16 AM, Joe Darcy wrote:
>> On 12/18/2012 04:12 PM, David Holmes wrote:
>>> On 19/12/2012 8:40 AM, Louis Wasserman wrote:
>>>> It's not 100% obvious to me whether this refers to a default
>>>> in an interface, a class which inherits that default implementation
>>>> does not override it, or both. Is that worth clarifying in the doc,
>>>> than forcing readers to check the JLS citation?
>>> The issue is where you obtained this Method reference from:
>>> - from the Interface? then it is a default method
>>> - from a class implementing the interface but not redefining the
>>> method? then it is a default method
>> Actually, that is *now* how HotSpot represents this case in core
>> reflection at the moment. HotSpot uses a new method object to represent
>> the default method woven into an implementing class.
> *now* -> *not* ??
> It may be a new Method object but getDeclaringClass() should give the
> interface class NOT the concrete class. That is currently the case for
> abstract interface methods. I hope it is the same for default methods!
It is not at the moment, which is a bit surprising.
More information about the core-libs-dev