Classfile API cannot encode Primitive Class as Condy

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 21
    • Affects Version/s: 21
    • Component/s: 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.

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

              Created:
              Updated:
              Resolved: