Ty vm. Will look into it, and more. On Mon, Dec 1, 2025, 9:10 AM Tagir Valeev <[email protected]> wrote:
> I don't think there are any published JEPs. Here's some information about > the project: > https://openjdk.org/projects/babylon/ > > On Mon, Dec 1, 2025, 15:08 David Alayachew <[email protected]> > wrote: > >> Understood. Thanks for clarifying. For now, I'll hold off on that, as I >> don't know how stable that is, and I don't really want to.build this new >> library off of it. Maybe when the respective JEP goes into preview. Could >> you link me to that JEP, or is there not one yet? >> >> On Mon, Dec 1, 2025, 9:01 AM Tagir Valeev <[email protected]> wrote: >> >>> Yes, you have to build it from the Babylon repo. >>> >>> On Mon, Dec 1, 2025, 14:35 David Alayachew <[email protected]> >>> wrote: >>> >>>> Thanks @Tagir Valeev <[email protected]>. >>>> >>>> I am still not great at the stuff Babylon is doing, so I can only >>>> roughly follow along. Regardless, it sounds like this is depending on >>>> Babylon features which have not yet landed in the mainline jdk, yes? >>>> >>>> >>>> On Mon, Dec 1, 2025, 5:22 AM Tagir Valeev <[email protected]> wrote: >>>> >>>>> I think this will surely be possible for RecordComponents with code >>>>> reflection (project Babylon), using the syntax you propose. >>>>> >>>>> You can create a quotable function like this: >>>>> >>>>> import jdk.incubator.code.*; >>>>> >>>>> @Reflect >>>>> @FunctionalInterface >>>>> interface Accessor { >>>>> Object get(Record r); >>>>> } >>>>> >>>>> Then create something like (just a sketch, sorry, I have no time now >>>>> to provide a full-fledged sample): >>>>> >>>>> static RecordComponent foo(Accessor acc) { >>>>> Quoted q = Op.ofQuotable(acc).orElseThrow(); >>>>> // extract a method handle from q using Babylon API >>>>> // unreflect it and find the corresponding RecordComponent >>>>> } >>>>> >>>>> With best regards, >>>>> Tagir Valeev >>>>> >>>>> On Sat, Nov 29, 2025 at 8:45 PM David Alayachew < >>>>> [email protected]> wrote: >>>>> >>>>>> Hello @amber-dev <[email protected]>, >>>>>> >>>>>> I asked this on core-libs-dev already, but I figured I should ask >>>>>> here too. >>>>>> >>>>>> Let's say I have some record User(String firstName, String lastName) >>>>>> {}. >>>>>> >>>>>> Is there any possible way for me to do the following? >>>>>> >>>>>> java.lang.reflect.RecordComponent firstName = foo(User::firstName); >>>>>> >>>>>> I'll even accept this. >>>>>> >>>>>> java.lang.reflect.Method lastName = foo(User::lastName); >>>>>> >>>>>> Thank you for your time and consideration. >>>>>> David Alayachew >>>>>> >>>>>
