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

j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int) implementation doesn't conform to the spec regarding REF_invokeInterface handling

    XMLWordPrintable

Details

    • b28
    • Verified

    Backports

      Description

        Specification j.l.constant.DirectMethodHandleDesc.Kind.valueOf(int)
        ( https://download.java.net/java/early_access/jdk17/docs/api/java.base/java/lang/constant/DirectMethodHandleDesc.Kind.html#valueOf(int) )
        says:

        > Returns the enumeration member with the given refKind field. Behaves as if valueOf(refKind, false). As a special case, if refKind is REF_invokeInterface (9) then the isInterface field will be true.

        However if we call

            Kind.valueOf(MethodHandleInfo.REF_invokeInterface);

        then IAE is thrown

           java.lang.IllegalArgumentException: refKind=9
        at java.base/java.lang.constant.DirectMethodHandleDesc$Kind.valueOf(DirectMethodHandleDesc.java:149)
        at java.base/java.lang.constant.DirectMethodHandleDesc$Kind.valueOf(DirectMethodHandleDesc.java:111)

        As if we call

            Kind.valueOf(MethodHandleInfo.REF_invokeInterface, false)

        and not as if the last arg is 'true'.

        Attachments

          Issue Links

            Activity

              People

                vromero Vicente Arturo Romero Zaldivar
                dbessono Dmitry Bessonov
                Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: