RFR: JEP 359-Records: reflection code

Chris Hegarty chris.hegarty at oracle.com
Tue Oct 22 09:41:28 UTC 2019

> On 22 Oct 2019, at 09:51, Maurizio Cimadamore <maurizio.cimadamore at oracle.com> wrote:
> ..
> Let me rephrase. We have Class::getRecordComponents; and we have RecordComponent::accessor.
> What is the need to pass _anything_ to the BSM, other than the record class (e.g. Point.class) AND the method name (e.g. toString) ?
> The BSM can take the .class, and get the components; from there:
> - you can easily derive names
> - you can also easily derive accessor MHs (just a lookup away)
> I was _not_ advocating for extracting a name from a direct method handle - that seems brittle, given that the compiler implementation might change, eventually. But doubling down on the reflection API seems the right thing to do?

A quick change shows that this simplifies the code a lot ( since there is less arg checking )

http://cr.openjdk.java.net/~chegar/records/ObjectMethods.00/ <http://cr.openjdk.java.net/~chegar/records/ObjectMethods.00/>

Q: the TypeDescriptor arg can be used for linking a dynamic constant. Is this still needed?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/compiler-dev/attachments/20191022/69da3040/attachment-0001.html>

More information about the compiler-dev mailing list