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

Provided supported mechanims to create a ModuleElement for an unnamed module

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P3 P3
    • 13
    • core-libs
    • None
    • behavioral
    • minimal
    • Java API
    • SE

      Summary

      Add a supported mechanism to create a module element for an unnamed module.

      Problem

      The javax.lang.model API does not include a specified and supported way to create object representing an unnamed module.

      Solution

      Augment the specification of Elements.getModuleElement to include this functionality. The wording is analogous to how unnamed packages are described for Elements.getPackageElement

      Specification

           /**
            * Returns a module element given its fully qualified name.
            *
      -     * If the named module cannot be found, {@code null} is
      +     * If the requested module cannot be found, {@code null} is
            * returned. One situation where a module cannot be found is if
            * the environment does not include modules, such as an annotation
            * processing environment configured for a {@linkplain
            * javax.annotation.processing.ProcessingEnvironment#getSourceVersion
            * source version} without modules.
            *
            * @implSpec The default implementation of this method returns
            * {@code null}.
            *
      -     * @param name  the name
      +     * @param name  the name, or an empty string for an unnamed module
            * @return the named module element, or {@code null} if it cannot be found
            * @see #getAllModuleElements
            * @since 9
            * @spec JPMS
            */
        default ModuleElement getModuleElement(CharSequence name)

      Note the wording is changed from "named module" to "requested module" since requesting an unnamed module is now supported.

          Loading...
          Uploaded image for project: 'JDK'
          1. JDK
          2. JDK-8216527

          Provided supported mechanims to create a ModuleElement for an unnamed module

            • Icon: CSR CSR
            • Resolution: Approved
            • Icon: P3 P3
            • 13
            • core-libs
            • None
            • behavioral
            • minimal
            • Java API
            • SE

              Summary

              Add a supported mechanism to create a module element for an unnamed module.

              Problem

              The javax.lang.model API does not include a specified and supported way to create object representing an unnamed module.

              Solution

              Augment the specification of Elements.getModuleElement to include this functionality. The wording is analogous to how unnamed packages are described for Elements.getPackageElement

              Specification

                   /**
                    * Returns a module element given its fully qualified name.
                    *
              -     * If the named module cannot be found, {@code null} is
              +     * If the requested module cannot be found, {@code null} is
                    * returned. One situation where a module cannot be found is if
                    * the environment does not include modules, such as an annotation
                    * processing environment configured for a {@linkplain
                    * javax.annotation.processing.ProcessingEnvironment#getSourceVersion
                    * source version} without modules.
                    *
                    * @implSpec The default implementation of this method returns
                    * {@code null}.
                    *
              -     * @param name  the name
              +     * @param name  the name, or an empty string for an unnamed module
                    * @return the named module element, or {@code null} if it cannot be found
                    * @see #getAllModuleElements
                    * @since 9
                    * @spec JPMS
                    */
                default ModuleElement getModuleElement(CharSequence name)

              Note the wording is changed from "named module" to "requested module" since requesting an unnamed module is now supported.

                    darcy Joe Darcy
                    darcy Joe Darcy
                    Jonathan Gibbons
                    Votes:
                    0 Vote for this issue
                    Watchers:
                    1 Start watching this issue

                      Created:
                      Updated:
                      Resolved:

                        darcy Joe Darcy
                        darcy Joe Darcy
                        Jonathan Gibbons
                        Votes:
                        0 Vote for this issue
                        Watchers:
                        1 Start watching this issue

                          Created:
                          Updated:
                          Resolved: