• Type: Sub-task
    • Status: New
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: 14
    • Fix Version/s: None
    • Component/s: specification
    • Labels:
    • Subcomponent:


      JVMS changes to define hidden classes. The following are the key characteristics:

         1. A hidden class is created by passing the bytes of a `ClassFile` structure to `Lookup::defineHiddenClass`.
         2. When a hidden class is created, no class loaders are recorded as initiating loaders of a hidden class, and no loading constraints are generated that involve hidden classes. Consequently, hidden classes are not known by any class loader: a symbolic reference in the run-time constant pool of a class D to a class C denoted by N will never resolve to a hidden class for any value of D, C, and N.
         3. A hidden class has a defining class loader that is needed for resolving types used by the hidden class's own fields and methods.
         4. Hidden classes cannot participate in static nest membership as they do not have names. NestHost/NestMembers attributes on hidden classes are ignored.
         5. Lookup::defineHiddenClass can optionally add a hidden class to the nest of the lookup class of the Lookup object.

      JVMS 5.4.4 specifies how the "statically defined" nest host of a class or interface M is determined. To support hidden nestmate class to be added in an existing nest, the runtime nest host of M will be determined as follows:
         - If M lacks a NestHost attribute, then M is its own nest host
         - If M has a NestHost attribute, follows the same as described in JVMS 5.4.4, and no error, then H is the runtime nest host of M
         - If M has a NestHost attribute, follows the same as described in JVMS 5.4.4, say symbolic reference at the host_class_index item of NH is named `H` and if one of the following errors occur
            i) class resolution of H fails
            ii) H is not in the same run-time package as M
            iii) H lacks a NestMembers attribute
            iv) H has a NestMembers attribute, but there is no entry in its classes array that refers to a class or interface with the same N where N is the name of M.
          then static nest membership validation fails and error is ignored, as if the NestHost
        attribute was not present, and M is its own runtime nest host.

      After validation of the asymmetric NH/NM attributes (or after a bad NH is thrown away), access control effects of nesting structure are applied uniformly across the nest




            • Assignee:
              mchung Mandy Chung
            • Votes:
              0 Vote for this issue
              2 Start watching this issue


              • Created: