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

Allow classes to be marked private within nests

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 12
    • Fix Version/s: tbd
    • Component/s: hotspot
    • Labels:
      None

      Description

      The nestmates feature allows declarations with private access to be shared between multiple classes. This raises the possibility that it would be semantically meaningful to apply ACC_PRIVATE to classes (including interfaces, I guess?). And there are reasonable use cases—classes that currently have package access could be more tightly controlled.

      JEP 181 did not pursue this feature, because it was not an essential part of the story. Instead, this bug is to track it as a potential future enhancement.

      The JEP 181 spec had this to say about specifying private class access:

      "A future enhancement may allow classes to be declared private, accessible only to nestmates. If that occurs, the steps to determine the nest host will have to change slightly, because there would be a circular dependency: nest host determination depends on class resolution, class resolution depends on class access control, and class access control depends on nest host resolution."

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                dlsmith Dan Smith
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated: