JDK 8 code review request for 8005042 Add Method.isDefault to core reflection (original) (raw)
David Holmes david.holmes at oracle.com
Wed Dec 19 00:20:49 UTC 2012
- Previous message: JDK 8 code review request for 8005042 Add Method.isDefault to core reflection
- Next message: JDK 8 code review request for 8005042 Add Method.isDefault to core reflection
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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 implementation in an interface, a class which inherits that default implementation and does not override it, or both. Is that worth clarifying in the doc, rather 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!
David
The class file and/or runtime representation of default methods may change before we're done; one reason to get the isDefault methods in core reflection and javax.lang.model now is to ease exploring alternatives.
-Joe
- from a class implementing the interface and redefining the method? then it is NOT a default method.
David -----
On Tue, Dec 18, 2012 at 2:32 PM, Joe Darcy<joe.darcy at oracle.com> wrote: Mandy and Jim, I'll correct the typos before I push. Thanks for the careful review, -Joe
On 12/18/2012 01:21 PM, Mandy Chung wrote: On 12/18/12 12:43 PM, Joe Darcy wrote: Hello, Please review these changes to add core reflection support to recognize default methods: 8005042 Add Method.isDefault to core reflection http://cr.openjdk.java.net/
**darcy/8005042.0/<http://cr.openjdk.java.net/darcy/8005042.0/>Looks good to me. For the test: 56 System.err.printf("ERROR: On %s expected isDefualt of ''%s''; got ''%s''.\n", 57 method.toString(), expected, actual); A typo 'isDefualt' -> 'isDefault'. This uses two single-quote characters to wrap the expected and actual value - is it intentional? I was wondering that you meant to use one singe-quote character. Mandy
- Previous message: JDK 8 code review request for 8005042 Add Method.isDefault to core reflection
- Next message: JDK 8 code review request for 8005042 Add Method.isDefault to core reflection
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]