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

@param with non-ascii variable names produces incorrect results

XMLWordPrintable

    • 9
    • b12
    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      The html generated by javadoc for @param tags on variables whose names are non-ascii is incorrect. In Java8 and earlier, it was correct, and subsequently it is not.

      If I have a method "int foo(int 大象);" then I would javadoc it using /** @param 大象 - The ({@code 大象} or 大象 chinese elephant) */". If I use javadoc on a file containing this, the following is generated

      <dl class="notes">
      <dt>Parameters:</dt>
      <dd><code>\u5927\u8c61</code> - The (<code>大象</code> or 大象 chinese elephant)</dd>
      </dl>

      It only seems to be the @param value that is affected. The fix for 8203176 resolved other similar issues.

      REGRESSION : Last worked in version 8u301

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run javadoc on the 'Source code for an executable test case'.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      When looking at the javadoc in (any) browser, the parameters are shown correctly. The html line generated line for the parameter is expected to be (something like)

      <dd><code>大象</code> - The (<code>大象</code> or 大象 chinese elephant)</dd>
      ACTUAL -
      The generated html is incorrect, and thus displays incorrectly in the browser. The offending line is

      <dd><code>\u5927\u8c61</code> - The (<code>大象</code> or 大象 chinese elephant)</dd>

      ---------- BEGIN SOURCE ----------
      /**
       * An elephant class.
       * (That is 大象} is chinese.
       * Use {@code 大象} in chinese.
       */
      public class Elephant {
          private int 大象;
          /**
           * Take a {@code 大象} or 大象 as a parameter.
           * That is a {@code 大象} or 大象.
           * @param 大象 The ({@code 大象} or 大象 chinese elephant)
           */
          public Elephant(int 大象) {
              this.大象 = 大象;
          }

          /**
           * Get the 大象.
           * @return The 大象.
           */
          public int get大象() {
              return 大象;
          }

          /**
           * Set the 大象.
           * @param 大象 The 大象.
           */
          public void set大象(int 大象) {
              this.大象 = 大象;
          }
      }

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

      FREQUENCY : always


        1. Elephant.java
          0.7 kB
        2. Error.png
          Error.png
          24 kB

            jjg Jonathan Gibbons
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: