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

Valid anchor 'id' value not allowed

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 15
    • Fix Version/s: 17
    • Component/s: tools
    • Labels:

      Description

      In HTML5, the 'id' attribute substitutes for the 'name' attribute for the 'a' tag.

      The W3C spec says
      The id global attribute is now allowed to have any value, as long as it is unique, is not the empty string, and does not contain space characters.

      However, the current DocLint implementation deals with 'id' as same as 'name', which doesn't accept some valid characters.

      $ cat A.java
      /**
       * <a id="foo()">valid</a>
       * <a id="ふー">valid</a>
       * <a id="foo ">invalid</a>
       */
      public class A {
      }
      javadoc -J-Duser.language=en -Xdoclint:all A.java [11:30:26]
      Loading source file A.java...
      Constructing Javadoc information...
      Standard Doclet version 14.0.1
      Building tree for all the packages and classes...
      A.java:2: error: invalid name for anchor: "foo()"
       * <a id="foo()">valid</a>
            ^
      A.java:3: error: invalid name for anchor: "\u3075\u30fc"
       * <a id="ふー">valid</a>
            ^
      A.java:4: error: invalid name for anchor: "foo "
       * <a id="foo ">invalid</a>
            ^
      Generating ./A.html...
      Generating ./package-summary.html...
      Generating ./package-tree.html...
      Generating ./constant-values.html...
      Building index for all the packages and classes...
      Generating ./overview-tree.html...
      Generating ./deprecated-list.html...
      Generating ./index-all.html...
      Building index for all classes...
      Generating ./allclasses-index.html...
      Generating ./allpackages-index.html...
      Generating ./system-properties.html...
      Generating ./index.html...
      Generating ./help-doc.html...
      3 errors

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ysatowse Yoshiki Sato
                Reporter:
                ysatowse Yoshiki Sato
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: