Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8304181

Constant Descriptors for MethodHandles::classData and classDataAt

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 21
    • core-libs
    • None
    • minimal
    • This is addition of new static final fields in a utility class, so the compatibility risk is minimal.
    • Java API
    • SE

      Summary

      Add Constant Descriptors for MethodHandles::classData and MethodHandles::classDataAt to ConstantDescs.

      Problem

      MethodHandles::classData and MethodHandles::classDataAt are APIs intended to be used as dynamic constant bootstrap methods, yet they lack Constant Descriptors in ConstantDescs.

      Solution

      Add constant descriptors for these two methods in ConstantDescs.

      Specification

      @@ -262,6 +262,22 @@ public final class ConstantDescs {
           /** {@link ClassDesc} representing the primitive type {@code void} */
           public static final ClassDesc CD_void = ClassDesc.ofDescriptor("V");
      
      +    /**
      +     * {@link MethodHandleDesc} representing {@link MethodHandles#classData(Lookup, String, Class)} MethodHandles.classData}
      +     * @since 21
      +     */
      +    public static final DirectMethodHandleDesc BSM_CLASS_DATA
      +            = ofConstantBootstrap(CD_MethodHandles, "classData",
      +            CD_Object);
      +
      +    /**
      +     * {@link MethodHandleDesc} representing {@link MethodHandles#classDataAt(Lookup, String, Class, int)} MethodHandles.classDataAt}
      +     * @since 21
      +     */
      +    public static final DirectMethodHandleDesc BSM_CLASS_DATA_AT
      +            = ofConstantBootstrap(CD_MethodHandles, "classDataAt",
      +            CD_Object, CD_int);
      +
           /** Nominal descriptor representing the constant {@code null} */
           public static final ConstantDesc NULL
                   = DynamicConstantDesc.ofNamed(ConstantDescs.BSM_NULL_CONSTANT,

            liach Chen Liang
            liach Chen Liang
            Jorn Vernee, Mandy Chung (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: