RFR: JDK-8260223: Handling of unnamed package in javadoc pages

Hannes Wallnöfer hannesw at openjdk.java.net
Fri Feb 19 16:03:58 UTC 2021


This replaces the unlocalized `<Unnamed>` string with a localized string resource in API docs covering code in the unnamed package. The name used in the default locale is "Unnamed Package". The old `<Unnamed>` token is still used as an internal placeholder, for example in `Extern.java` and in the search index files.

Previously, we had two distinct `getPackageName(PackageElement)` methods, one in `HtmlDocletWriter` returning a Content object and one in `Utils` returning a String. The former is now changed to return the localized content resource. To disambiguate it from the latter, it is renamed to `getLocalizedPackageName`. I also added reciprocal references to the doc comments in both methods.

A few minor notes on changes that may not be obvious:

 - In the package and module summary pages, I replaced the ` `  in the heading with an ordinary space character as the full content of the `<h1>` element now also appears in its `title` attribute, where entities are not supported.
 - I added an extra set of source files to test Use pages in `TestUnnamedPackage` as the existing sources contained an illegal Java file, causing `PackageUseWriter` to fail.

-------------

Commit messages:
 - JDK-8260223: Handling of unnamed package in javadoc pages

Changes: https://git.openjdk.java.net/jdk/pull/2648/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2648&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8260223
  Stats: 208 lines in 33 files changed: 103 ins; 38 del; 67 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2648.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2648/head:pull/2648

PR: https://git.openjdk.java.net/jdk/pull/2648


More information about the javadoc-dev mailing list