On Mon, 6 Feb 2023 14:09:08 GMT, Adam Sotona <asot...@openjdk.org> wrote:

>> src/java.base/share/classes/jdk/internal/classfile/BootstrapMethodEntry.java 
>> line 41:
>> 
>>> 39:  * part of the constant pool.
>>> 40:  */
>>> 41: public sealed interface BootstrapMethodEntry
>> 
>> Usages of this seem all to fall into the `constantpool` package - does this 
>> interface belong there?
>
> `BootstrapMethodEntry` is not a constant pool entry, but 
> `BootstrapMethodsAttribute` entry.
> It might be rather moved under `attribute` package and renamed to 
> `BootstrapMethodInfo` to follow the same pattern as other attributes/infos.

I know it's part of an attribute - but reading the javadoc:

/**
 * Models an entry in the bootstrap method table.  The bootstrap method table
 * is stored in the {@code BootstrapMethods} attribute, but is modeled by
 * the {@link ConstantPool}, since the bootstrap method table is logically
 * part of the constant pool.
 */
 ```
 
 And also, seeing the method:
 
 ```
 /**
     * {@return the constant pool associated with this entry}
     */
    ConstantPool constantPool();


It seems like the API is doing the (justifiable) trick of making BSMs look like 
if they are first-class CP entries (even if not specified that way in the 
JVMLS). I think that's a fine move, but if we go down that path we should be 
honest, and put this class in constantpool. At least this is my 0.02$.

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

PR: https://git.openjdk.org/jdk/pull/10982

Reply via email to