Search code examples
javabyte-buddy

Why does JavaConstant.MethodHandle's documentation say that constant MethodHandles cannot be represented in a class' constant pool?


The javadoc for Byte Buddy's JavaConstant.MethodHandle says:

Note that constant MethodHandles cannot be represented within the constant pool of a Java class

But section 4.4.8 from the Java Virtual Machine Specification, which is talking about a Java class' constant pool, says:

The CONSTANT_MethodHandle_info structure is used to represent a method handle

What is Byte Buddy's documentation trying to say?


Solution

  • How embarrassing; it looks like the documentation is trying to tell me something about a state of affairs that I actually fixed. See: If I have a JavaConstant.MethodHandle and I want to somehow pass it to MethodCall.invoke() is there a way to do it?

    I think this means this documentation is now simply incorrect, since in fact Byte Buddy representations of constant method handles can be stored in the constant pool.