[code-reflection] RFR: BytecodeGenerator support of lambdas [v7]

Paul Sandoz psandoz at openjdk.org
Mon Apr 15 22:47:09 UTC 2024


On Mon, 15 Apr 2024 06:41:51 GMT, Adam Sotona <asotona at openjdk.org> wrote:

>> What's the problem here? I recall LambdaMetafactory is designed with hidden class support in mind, that it generates compatible class names if possible.
>> 
>> Since hidden classes allow duplicate names (as it is defined with random suffix), does this break existing usages?
>
> Unfortunately this is a different case. We generate a hidden class with lambda implementation method inside and `LambdaMetafactory` could not (and according to the spec should not) find the class.

An unfortunate consequence is it is now possible to get linkage errors when generating bytecode for two code model functions with the same name. This causes the `CoreBinaryOpsTest` to fail.

One solution is to append a randomly generated UUID to the class name. Another is to checking if the existing name already resolves to a class, and if so append a count, and repeat until resolution fails. Although that would require some synchronation to protect against races.

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

PR Review Comment: https://git.openjdk.org/babylon/pull/48#discussion_r1566513665


More information about the babylon-dev mailing list