How are bootstrap methods registered to the constant pool in Java?

569 Views Asked by At

I've been poking around invokedynamic and MethodHandles information recently.

It seems that BOTH Linkage.registerBootstrapMethod() and @BootstrapMethod are deprecated as means of marking bootstrap methods as such.

How are they registered to the constant pool?

1

There are 1 best solutions below

0
On

As of Java 8, there is no Java language-level support for registering bootstrap methods. Bootstrap methods are registered by a bytecode emitter (source-to-bytecode compiler, bytecode transformer, instrumentation agent, etc.) in the BootstrapMethods attribute in the class file(s) from which they are used by CONSTANT_InvokeDynamic_info values in the constant pool, which are in turn referenced by invokedynamic instructions.