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

Self-closing elements are no longer allowed in javadocs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 8u45
    • tools

      FULL PRODUCT VERSION :
      java version "1.8.0_45"
      Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      In Java 1.7 and before, I could create a new line in javadocs in one of two ways:

      <p>

      <p/>

      Both of them worked fine. I tended to use the second one because the way most IDEs work these days, if I type <p>, it will immediately insert </p> after the cursor. This is fine tags that need content, but it's annoying for the <p> tag. Fortunately, this behavior may be easily defeated by typing <p/> instead.

      Unfortunately, in Java 8, these gets generate the following error message:

      error: self-closing element not allowed

      Huh? This is completely unexpected, and as far as I can tell, completely superfluous. Self-closing elements are common in html and don't cause any problems.

      A lot of javadocs code exists that uses self-closing elements, which must now be rewritten. Because this generates a javadoc error instead of a warning, it actually prevents the javadocs from generating documentation for the class.

      There is also, as far as I can tell, no advantage to disallowing self-closing elements. In Java 1.7 and before, the <p/> would get inserted directly into the javadocs file, where it worked properly in every browser I tried.

      Also, I couldn't find anything in the Javadocs documentation that describes this restriction. So this appears to be an undocumented restriction.

      REGRESSION. Last worked in version 7u80

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.7.0_40"
      Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
      Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Generate Javadocs for the supplied annotation source

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      javadocs tool should generate html files with javadocs for the supplied source code.
      ACTUAL -
      Javadocs generates an error message, and no html files are created.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      C:\quattro\MR82\uimodule\src\main\java\com\x\core\util\BusinessKey.java:6: error: self-closing element not allowed


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package com.x.core.util;


      /**
       * BusinessKey annotation
       * <p/>
       * Marks the field for use in the hash-code() and equals() methods.
       */
      public @interface BusinessKey {
      }

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

            pardesha Pardeep Sharma
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: