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

Provided supported mechanims to create a ModuleElement for an unnamed module

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P3
    • Resolution: Approved
    • Fix Version/s: 13
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      minimal
    • Interface Kind:
      Java API
    • Scope:
      SE

      Description

      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.

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                darcy Joe Darcy
                Reporter:
                darcy Joe Darcy
                Reviewed By:
                Jonathan Gibbons
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: