[External] : Re: Method and Field Literals

arjan tijms arjan.tijms at gmail.com
Sun Apr 24 09:31:41 UTC 2022


On Sun, Apr 24, 2022 at 1:17 AM Ethan McCue <ethan at mccue.dev> wrote:

> Before moving on with the discussion, can you also address Brain Goetz's
> questions directly?
> 1. what do you expect the _type_ of a method literal is?


2. Is it a goal to have
>     a. earlier error checking that you specified a method that exists
>     b. syntactic sugar for the reflective call
>     c. the lookup can be more efficient


And then from me
> 3. What in your first example disqualifies a normal method reference
> lambda (Class::method) from being appropriate?

If you mean the Query example:


Then it's not about the actual value of Student.gradYear at this point, but
about the identity of the property. It's used to (ultimately) generate SQL.
The property (field, method) needs to be identified, in order to
read annotations from it that specify the mapping.

If you mean the handler and interceptor examples, then it's checking that
an invoked (intercepted / handled) method is the intended method.

> 4. This pattern of
>     var thing = Lookup.find("externalUncheckedName", TypeA.class,
> TypeB.class)
>     var result = (TypeB) thing.invoke(new TypeA()); // Object... as arg
> type and throws some exceptions
> is also used in the API for Panama. If we are going to add new goo, is
> there a way to address this sort of API as well?

Is "externalUncheckedName" a method name there?

Kind regards,
Arjan Tijms

More information about the discuss mailing list