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

Classfile API cannot encode Primitive Class as Condy

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 21
    • 21
    • core-libs
    • b22
    • generic
    • generic
    • Verified

      Consider this code example:

          cob.constantInstruction(clazz.describeConstable().orElseThrow());

      This fails for primitive classes, as Classfile API always assume ClassDescs are always encodeable as a class constant. The check in BytecodeHelpers should check for

          if (constantValue instanceof ClassDesc value && !value.isPrimitive())

      As only classes or interfaces or arrays are eligible to be encoded in class constants. Discovered while converting SerialPersistentFieldsTest for JDK-8294977.

            liach Chen Liang
            liach Chen Liang
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: