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

Classfile API cannot encode Primitive Class as Condy

    XMLWordPrintable

Details

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

    Description

      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.

      Attachments

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: