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

@uses and @provides don't work if service type not in a module is documented

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • 9, 11, 25
    • tools

      ADDITIONAL SYSTEM INFORMATION :
      openjdk 24.0.1 2025-04-15
      OpenJDK Runtime Environment Temurin-24.0.1+9 (build 24.0.1+9)
      OpenJDK 64-Bit Server VM Temurin-24.0.1+9 (build 24.0.1+9, mixed mode, sharing)

      Windows 10/11

      A DESCRIPTION OF THE PROBLEM :
      When a module uses or provides a service it can be documented using the @uses and @provides tags, respectively. These tags go in the module-info.java file and result in a "Services" section being generated for the module summary page. However, this only works if the service type is in one of the modules currently being documented by the Javadoc tool. If a module @provides a "third-party" SPI (including those from the standard library), then that fact won't appear in that module's documentation.

      All @uses and @provides should be included in the module summary regardless of where the service type comes from.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      1) Copy test case code into a project.

      2) Generate documentation: javadoc --module-source-path <path> --module mytool -d <dest>

      3) Open index.html (from the generated docs) in a browser.



      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The module summary should show that java.util.spi.ToolProvider is provided by the mytool module.
      ACTUAL -
      No "Services" section is generated for the module summary at all, let alone a "Provides" section showing java.util.spi.ToolProvider.

      ---------- BEGIN SOURCE ----------
      module-info.java

      /**
       * A demo module.
       *
       * @provides java.util.spi.ToolProvider
       */
      module mytool {

        provides java.util.spi.ToolProvider with
            com.example.mytool.MyToolProvider;
      }

      com/example/mytool/MyToolProvider.java

      package com.example.mytool;

      import java.io.PrintWriter;
      import java.util.spi.ToolProvider;

      public class MyToolProvider implements ToolProvider {

        @Override
        public String name() {
          return "mytool";
        }

        @Override
        public int run(PrintWriter out, PrintWriter err, String... args) {
          return 0;
        }
      }

      ---------- END SOURCE ----------

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: