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

Broken links when generating from project without modules

XMLWordPrintable

    • b26
    • x86_64
    • generic

        ADDITIONAL SYSTEM INFORMATION :
        Linux 64-bit (CentOS)
        openjdk version "12-ea" 2019-03-19
        OpenJDK Runtime Environment (build 12-ea+23)
        OpenJDK 64-Bit Server VM (build 12-ea+23, mixed mode, sharing)

        A DESCRIPTION OF THE PROBLEM :
        When you generate javadoc for a project that does not declare modules (no module-info.java source files), navigating to documentation for a class in any package adds "undefined/" to the URL. This can be solved by adding --no-module-directories to the javadoc command. However, if you also reference external javadoc using -link to documentation that uses modules (e.g. Java 11), links to those classes are broken.

        This was reported to have been fixed as part of JDK-8205593 (see [comment](https://bugs.openjdk.java.net/browse/JDK-8205593?focusedCommentId=14215770&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-14215770)), but this variant at least does not appear to be fixed.

        REGRESSION : Last worked in version 8u191

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        1. Create a file named "WithPackage.java" anywhere with the contents from the source code below. Run one of the following commands:

          A: javadoc -d ./doc -link 'https://docs.oracle.com/en/java/javase/11/docs/api/' **/*.java
          B: javadoc -d ./doc --no-module-directories -link 'https://docs.oracle.com/en/java/javase/11/docs/api/' **/*.java

        2. Open ./doc/index.html and search for "WithPackage"
        3. Navigate to the result (works with A, but not with B)
        4. Navigate to the link for "java.lang.Object"

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        Navigating at step 3 and 4 result in the expected page and no 404 error
        ACTUAL -
        Step 3: Works with A, fails with B with an additional "undefined/" in the URL (.../doc/undefined/test/WithPackage.html instead of .../doc/test/WithPackage.html)
        Step 4: Fails with A (https://docs.oracle.com/en/java/javase/11/docs/api/java/lang/Object.html?is-external=true), works with B (https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/lang/Object.html?is-external=true)

        ---------- BEGIN SOURCE ----------
        package test;

        /**
         * Searching for this will fail with "undefined/" in the URL unless you build
         * with {@code --no-module-directories} specified on the javadoc command line.
         * However, when you do add the {@code --no-module-directories}, links to Java
         * documentation fail.
         */
        public class WithPackage {

        }
        ---------- END SOURCE ----------

        FREQUENCY : always


              hannesw Hannes Wallnoefer
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: