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

Clarify Lookup::defineHiddenClass spec @throws IAE if the bytes has ACC_MODULE flag set

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 15
    • None
    • core-libs

    Description

      Tested method: MethodHandles.Lookup defineHiddenClass
      List of assertions:
      1. Creates a hidden class or interface C from bytes, returning a Lookup on the newly created class or interface.

      C is derived with name CN, class loader L, and purported representation newBytes as if by the rules of JVMS 5.3.5..:

      JVMS 5.3.5:
      2. Otherwise, the Java Virtual Machine attempts to parse the purported representation. However, the purported representation may not in fact be a valid representation of C.

      This phase of loading must detect the following errors:

       Otherwise, if the purported representation does not actually represent a class named N, loading throws an instance of NoClassDefFoundError or an instance of one of its subclasses.

      This occurs when the purported representation ... has an access_flags item which has the ACC_MODULE flag set.

      The implementation throws IllegalArgumentException although NoClassDefFoundError is expected.

      The API spec does not state behavior in the case when ACC_MODULE is set in an array of bytes presenting a class File, thus the implementation should follow JVMS 5.3.5 and throws NoClassDefFoundError

      Attachments

        Issue Links

          Activity

            People

              mchung Mandy Chung
              lkuskov Leonid Kuskov
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: