On Sat, 20 Jul 2024 06:28:12 GMT, Shaojin Wen <d...@openjdk.org> wrote:

> If code is generated through ClassFile, how to access the private methods of 
> classes such as String/StringConcatHelper?

In that case, you have to encode those methods as live `MethodHandle` objects, 
passed to the generated class with `defineHiddenClassWithClassData` (just pass 
the class data object)
They can be retrieved in generated code with a CONDY using 
`MethodHandles.classData`. (This is how the MethodHandle LambdaForm classes 
referred to other MethodHandles)

----

You don't really need to worry about experimenting with bytecode generation 
right now. This patch as is is very good, and tier 1-3 tests pass. Bytecode gen 
is aimed at more complex scenarios with multiple constants and various types of 
arguments instead of this simple concat case.

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

PR Comment: https://git.openjdk.org/jdk/pull/20253#issuecomment-2240961431

Reply via email to