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

Specification of java.lang.module.ModuleDescriptor.packages() method can be improved

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 26
    • core-libs
    • None
    • behavioral
    • minimal
    • The API specification has been updated to match the current implementation of that method. No compatibility impact is expected due to this change.
    • Java API
    • SE

      Summary

      The specification of java.lang.module.ModuleDescriptor.packages() method is updated to clarify that it returns a set of all packages that belong to the module.

      Problem

      The current specification of ModuleDescriptor.packages() states:

      /**
       * Returns the set of packages in the module.
       *
       * <p> The set of packages includes all exported and open packages, as well
       * as the packages of any service providers, and the package for the main
       * class. </p>
      

      It's not clear from that text that the implementation of this method returns all packages that belong to the module irrespective of the accessibility of those packages.

      Solution

      The text is updated to match the current implementation of that method.

      Specification

      /**
       * Returns the set of all packages in the module.
       *
       * @return A possibly-empty unmodifiable set of the packages in the module
       */
      public Set<String> packages() {

            jpai Jaikiran Pai
            jpai Jaikiran Pai
            Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: