[code-reflection] RFR: Replace use of MethodTypeDesc with FunctionType [v3]

Maurizio Cimadamore mcimadamore at openjdk.org
Thu Feb 15 10:01:06 UTC 2024


On Wed, 14 Feb 2024 23:04:24 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:

> It's as if there is a function that does the following:
> 
> ```
> C f(P1 p1, ..., PN pn) {
>   return new C(p1, ..., pn);
> }
> ```
> 
> or in your example:
> 
> ```
> Box<String>) f() {
>   return new Box<String>();
> }
> ```
> 
> We use the "type" of that function as an attribute of the new operation. I was hoping to generalize like that and then more specific details appear (as you indicate) as we interpret or lower to bytecode.

I get that - but that function you describe will give you the "instantiated" signature. The catch-22 is that there is no way to get from that instantiated signature back to the erased form that e.g. `MethodHandles.Lookup` need. E.g. once your type is `(String)V` there's no way for a processor to go back to `(Object)V` (which is what the lookup type should be). That's why e.g. javac needs to carry both pieces of information and go back and forth between the two as needed.

-------------

PR Comment: https://git.openjdk.org/babylon/pull/22#issuecomment-1945736502


More information about the babylon-dev mailing list