JavaDoc Updates - Sip of Java

With every release, both the JavaDoc tool and the official JDK JavaDoc have seen steady improvements. Let’s review some of the changes that have happened between JDK 11 and JDK 18.

Responsive UI

Generated JavaDoc is now more responsive to different screen resolutions. Changes to JavaDoc include; the top menu turning into a “hamburger” menu at resolutions typically found on mobile devices, restructuring the page to better fit smaller screen resolutions, and resolving numerous graphical glitches. These changes should make the experience of viewing JavaDoc while on a mobile device much more pleasant.

JavaDoc will automatically generate links to the super class or interface for inherited or implemented methods or fields. This can make it easier to find and understand a class’ inherited behavior, or how an interface intends an API to be consumed by a client. If the super class is a JDK class, the link will point to the appropriate version of the class in the official JDK JavaDoc.

Updates to the Index Page

The Index page has had three new pages added to it; Constant Field Values, Serialized Form, and System Properties. That can provide easy reference to important values, serialized behavior, and context for how to supply values and properties to the system.

Constant Field Values

The Constant Field Values page displays all constant fields and their values, alphabatized by package, class, and then by field name. The JavaDoc tool will automatically detect all constant fields (fields marked as public or protected and are static and final).

Serialized Form

The Serialized Form page shows all classes that have implemented the Serializable interface. On this page, the class’ serialVersionUID value is shown as well as all serializable fields, along with the field’s JavaDoc.

System Properties

Knowing all the values that can be set or provided to a system can be important for understanding how to properly configure it. Previously, finding and understating how to use these system properties was difficult as there was no way to mark and associate them in JavaDoc. To address this shortcoming, the {@SystemProperty} tag can be used for the easy marking of system property fields, which, with JDK 18, will then be collected on the System Properties page. The system properties page will provide a link to the JavaDoc of the system property, which should provide an explanation of how the system property should be used, as well its default value(s) if appropriate.

Further Reading

Happy coding!