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

Example in ServiceLoader API docs should have one provides directive

XMLWordPrintable

    • b27
    • Not verified

      ADDITIONAL SYSTEM INFORMATION :
      Java 11 SE API docs for ServiceLoader

      A DESCRIPTION OF THE PROBLEM :
      Docs currently say:

       As an example, suppose a module specifies the following directives:


           provides com.example.CodecFactory with com.example.impl.StandardCodecs;
           provides com.example.CodecFactory with com.example.impl.ExtendedCodecsFactory;
       
      Whereas spec says multiple service providers for a particular service, need to be comma-separated. The above would produce error on compilation, because there are two separate 'provides' statements for the same service.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/ServiceLoader.html

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
       As an example, suppose a module specifies the following directive:


           provides com.example.CodecFactory with com.example.impl.StandardCodecs, com.example.impl.ExtendedCodecsFactory;
       
      ACTUAL -
       As an example, suppose a module specifies the following directives:


           provides com.example.CodecFactory with com.example.impl.StandardCodecs;
           provides com.example.CodecFactory with com.example.impl.ExtendedCodecsFactory;
       

      FREQUENCY : always


            fguallini Fernando Guallini
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: