JDK-8271083 : ☂ Missing documentation in JavaFX API
  • Type: Task
  • Component: javafx
  • Sub-Component: other
  • Priority: P4
  • Status: Resolved
  • Resolution: Delivered
  • Submitted: 2021-07-21
  • Updated: 2024-03-05
  • Resolved: 2024-03-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
jfx23Resolved
Related Reports
Blocks :  
Blocks :  
Blocks :  
Blocks :  
Blocks :  
Blocks :  
Blocks :  
Blocks :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
This is an umbrella task to track improving the JavaFX API docs, specifically relating to API elements where the documentation is missing. Bugs or RFEs to address these issues will be tracked with linked blocking issues. Many of these problems are related to JavaFX properties, but there are other constructors, methods, and fields that are missing documentation as well.

The javadoc tool in JDK 16 and later produces warnings if a constructor, method, or field that is part of the API has no javadoc comments. Currently the tool produces several spurious warnings, but the fix for JDK-8269774 (which is under review), will eliminate those such that what remains are valid problems in the FX API documentation.

Before listing the specific problems that I have found, here is some background information on JavaFX properties. Most of the Definitions section came from a writeup that Jon attached to JDK-8270195 as "fx-notes.md", which has many additional details if more information is desired.


Definitions:

* A property is defined implicitly by a no-args method whose name ends in Property and whose return type is a subtype of javafx.beans.Observable.

* The name of the property is the part of the method name before "Property". The type of the property is the return type of the method. The name of the property must not start with "get", "set", or "is" and must not end with "Property". It should be camel case with an initial lower-case letter so that all methods follow the usual convention.

* A property may have a like-named field of the appropriate type. The field is typically private.

* A property may have getter and setter methods. The getter method may be named "is..." for boolean properties, and typically is so named.


Examples:

* A double property named "layoutX"

private DoubleProperty layoutX;
public final DoubleProperty layoutXProperty() { ... }
public final double getLayoutX() { ... }
public final setLayoutX(double val) { ... }

* A read-only boolean property named "disabled" (so no setter)

private ReadOnlyBooleanProperty disabled;
public final ReadOnlyBooleanProperty disabledProperty() { ... }
public final double isEnabled() { ... }


Rules and best practices:

1. As a rule, exactly one of the (private) xxxxx field or the xxxxxProperty() method must have a javadoc comment block for a given property. This is used as the description for that property. If the description is on the Property method it should include an `@return` tag.  It is a mistake to add javadoc comments to both the field and the Property method. This will lead to a non-suppressable warning in a future version of the javadoc tool. If neither the method nor field has a javadoc comment block, the javadoc tool will issue a warning that the method has no comments. The generated API docs will not have any description for that property. Note that a Property method in a subclass need not have documentation if that method overrides a Property method defined in a (usually abstract) superclass or interface that has the documentation.

2. As a best practice, the setter and getter methods, if present, should not have any API docs. Anything relating to the use or description of the property should go into the description on the field or Property method. An exception to this can be made if are special considerations for the method itself (e.g., if the setter or getter needs a different `@since` tag because it was added after the Property method). There should only be a very few examples where this is needed.

Comments
All blocking tasks are resolved, so marking this umbrella task as "Delivered".
05-03-2024

Additional related bugs: JDK-8227764: Missing docs for getClassCssMetaData() and getControlCssMetaData(). I don't intend to work on it anytime soon, so it's better to assign it to someone else who is familiar with CSS. Actually, it looks like JDK-8271091: "Missing API docs in UI controls classes" handles these, so a duplicate? JDK-8227765: {@inheritDoc} does not work for methods inherited from the JDK. Related to JDK-8271485? Should be reassigned as well since someone is already working in this area, JDK-8229190: Update existing docs with missing resources and JDK-8229200: Add missing resources to generated docs Not sure if these fit under this umbrella issue.
20-10-2021

I used the results of running the following to generate a list of missing comments: ``` $ gradle sdk javadoc $ rm -rf build/javadoc $ $JDK_HOME/bin/javadoc -Xmaxwarns 1000 @build/modulesourcepath.args @build/tmp/javadoc/javadoc.options >& build-javadoc.log ``` where JDK_HOME pointed to a local build of JDK 18 with the patch from https://github.com/openjdk/jdk/pull/4747 applied to fix JDK-8269774. I then split the list into 4 groups: one for javafx.css, which I attached to existing bug JDK-8250590, and three others from which I filed three new bugs: JDK-8270996: JavaFX serialized classes get javadoc warnings for missing comments JDK-8271090: Missing API docs in scenegraph classes JDK-8271091: Missing API docs in UI controls classes
21-07-2021