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

Clarify the name of the main class, services and provider classes in module descriptor

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 22
    • core-libs
    • None
    • behavioral
    • minimal
    • No change in the implementation. Spec change only.
    • Java API
    • SE

      Summary

      Clarify the spec of ModuleDescriptor::mainClass, ModuleDescriptor::uses, ModuleDescriptor.Provides::service and ModuleDescriptor.Provides::providers to return the binary name.

      Problem

      The spec of ModuleDescriptor::mainClass, ModuleDescriptor::uses, ModuleDescriptor.Provides::service and ModuleDescriptor.Provides::providers state that these APIs return a fully qualified class name. The current behavior returns a binary name.

      Solution

      Update the spec of ModuleDescriptor::mainClass, ModuleDescriptor::uses, ModuleDescriptor.Provides::service and ModuleDescriptor.Provides::providers to return the binary name.

      Specification

      diff --git a/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java b/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java
      index 3972084eca2..b38d1b0cc87 100644
      --- a/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java
      +++ b/src/java.base/share/classes/java/lang/module/ModuleDescriptor.java
      @@ -847,26 +847,25 @@ public class ModuleDescriptor
               }
      
               /**
      -         * Returns the fully qualified class name of the service type.
      -         *
      -         * @return The fully qualified class name of the service type
      +         * {@return the {@linkplain ClassLoader##binary-name binary name} of the service type}
                */
               public String service() { return service; }
      
               /**
      -         * Returns the list of the fully qualified class names of the providers
      -         * or provider factories.
      +         * Returns the list of the {@linkplain ClassLoader##binary-name binary names}
      +         * of the providers or provider factories.
                *
      -         * @return A non-empty and unmodifiable list of the fully qualified class
      -         *         names of the providers or provider factories
      +         * @return A non-empty and unmodifiable list of the {@linkplain ClassLoader##binary-name
      +         *         binary names} of the providers or provider factories
                */
               public List<String> providers() { return providers; }
      
               /**
                * Compares this {@code Provides} to another.
                *
      -         * <p> Two {@code Provides} objects are compared by comparing the fully
      -         * qualified class name of the service type lexicographically. Where the
      +         * <p> Two {@code Provides} objects are compared by comparing the
      +         * {@linkplain ClassLoader##binary-name binary name}
      +         * of the service type lexicographically. Where the
                * class names are equal then the list of the provider class names are
                * compared by comparing the corresponding elements of both lists
                * lexicographically and in sequence. Where the lists differ in size,
      @@ -1446,8 +1445,8 @@ public class ModuleDescriptor
            * <p> If this module is an automatic module then the set of service
            * dependences is empty. </p>
            *
      -     * @return  A possibly-empty unmodifiable set of the fully qualified class
      -     *          names of the service types used
      +     * @return  A possibly-empty unmodifiable set of the {@linkplain ClassLoader##binary-name
      +     *          binary names} of the service types used
            */
           public Set<String> uses() {
               return uses;
      @@ -1510,7 +1509,7 @@ public class ModuleDescriptor
           /**
            * <p> Returns the module main class. </p>
            *
      -     * @return The fully qualified class name of the module's main class
      +     * @return The {@linkplain ClassLoader##binary-name binary name} of the module's main class
            */
           public Optional<String> mainClass() {
               return Optional.ofNullable(mainClass);

            mchung Mandy Chung (Inactive)
            mchung Mandy Chung (Inactive)
            Alan Bateman
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: