跳到主要内容

JEP 224: HTML5 Javadoc

Summary

Enhance the javadoc tool to generate HTML5 markup.

Goals

Provide an option to the standard doclet to request either HTML 4 or HTML5 output. The HTML5 markup is semantic, i.e., clearly separating meaning from style and content. The parts of the pages generated by the standard doclet using HTML5 markup satisfy accessibility requirements.

Non-Goals

It is a not a goal to replace the current three-frame/no-frame structure of the generated HTML pages; that may be the subject of a future JEP.

It is not a goal to mandate the use of HTML5 in documentation comments, nor is it a goal to provide the ability to convert documentation comments written using HTML 4 to HTML5.

Motivation

In JDK 8 and older releases, the standard doclet generated pages in HTML 4.01, which is an old standard, and not not provide support for satisfying accessibility requirements.
HTML5 is the latest standard for HTML. HTML5 increases the semantic value of web pages and makes it easier to create accessible web pages.

Description

  • A command-line option is added to the standard doclet to request a specific type of output markup. HTML4, which is the current type, will be the default. HTML5 will become the default in JDK 10.

  • The semantic value of the generated HTML is improved by using structural HTML5 elements such as header, footer, nav, etc.

  • The HTML5 markup implements the WAI-ARIA standard for accessibility. Specific roles are assigned to elements in the HTML document using the role attribute.

  • The -Xdoclint feature is update to check documentation comments for common errors, based upon the requested type of output markup.

Testing

Tests are provided to ensure that:

  • The HTML5 markup is valid
  • The HTML5 markup is accessible
  • The new command-line option works correctly
  • The HTML5 markup works across all supported browsers

The lack of automated tools to test accessibility hampers comprehensive accessibility testing. A representative sample of different types of pages can checked using online web-based tools.