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

[Nestmates] The new Class nestmate methods should have SecurityManager checks

XMLWordPrintable

      Mandy writes:

      > I think Class::getNestHost and Class::getNestMembers should do a security
      > permission check as performed in other method e.g. getEnclosingClass.
      >
      > * @throws SecurityException
      > * If a security manager, <i>s</i>, is present and
      > * the caller's class loader is not the same as or an
      > * ancestor of the class loader for the current class and
      > * invocation of {@link SecurityManager#checkPackageAccess
      > * s.checkPackageAccess()} denies access to the package
      > * of this class
      > *

      This seems not completely unreasonable. Should they also be @CallerSensitive?

      But it is contrary to getNestHost()s design of never throwing an exception. So this needs more consideration.

            dholmes David Holmes
            dholmes David Holmes
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: