JDK-8269774 : doclint reports missing javadoc comments for JavaFX properties if the docs are on the property method
  • Type: Bug
  • Component: tools
  • Sub-Component: javadoc(tool)
  • Affected Version: 16
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-07-01
  • Updated: 2021-08-16
  • Resolved: 2021-08-11
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.
JDK 18
18 masterFixed
Related Reports
Relates :  
Relates :  
Description
This is a follow-on to JDK-8249633. We noticed this recently when we switched to using JDK 16 as the boot JDK for building JavaFX 17.

Running doclint  on the JavaFX API classes reports missing javadoc comments for JavaFX properties where the docs are on the property method instead of the (private) property object.

If the docs are either on the private xxxxx property object or on the xxxxxProperty() method, the correct javadocs will be generated. For example:

case 1: docs on the property object (this is the more common case)

    /**
     * The foo property.
     */
    private DoubleProperty foo;

    public final DoubleProperty fooProperty();

    public final double getFoo();

    public final void setFoo(double foo);


case 2: docs on the property method

    private DoubleProperty bar;

    /**
     * The bar property.
     * @return the property object
     */
    public final DoubleProperty barProperty();

    public final double getBar();

    public final void setBar(double bar);


Both cases will generate the correct docs, but in the latter case, an incorrect "missing comments" warning is generated.

I can create a test case, or you can reproduce this by cloning https://github.com/openjdk/jfx.git and building the docs as follows:

$ bash gradlew --info javadoc

If I increase the max warnings we get a total of 528 warnings. Some of the warnings are very likely valid, but most of the ones I spot checked are because of this bug.
Comments
Changeset: 9ba8a12c Author: Jonathan Gibbons <jjg@openjdk.org> Date: 2021-08-11 18:04:29 +0000 URL: https://git.openjdk.java.net/jdk/commit/9ba8a12cfbb3d7d17be454e29ee6ff476c8690c2
11-08-2021

This is the relevant line in MemberSummaryBuilder that is triggering the message: if (field == null || builder.utils.getDocCommentTree(field) == null) { The expression builder.utils.getDocCommentTree(field) == null should be replaced with builder.utils.hasDocCommentTree(field)
09-07-2021

OK. I have a test case. The unwanted `no comment` message is being generated from the private field. Here's the relevant trace: play/demo/src/C.java:20: warning: no comment private DoubleProperty v3; ^ java.lang.RuntimeException at jdk.compiler/com.sun.tools.javac.util.Log.writeDiagnostic(Log.java:738) at jdk.compiler/com.sun.tools.javac.util.Log$DefaultDiagnosticHandler.report(Log.java:690) at jdk.compiler/com.sun.tools.javac.util.Log.report(Log.java:660) at jdk.compiler/com.sun.tools.javac.util.AbstractLog.warning(AbstractLog.java:181) at jdk.compiler/com.sun.tools.javac.api.JavacTrees.printMessage(JavacTrees.java:1270) at jdk.compiler/com.sun.tools.javac.api.JavacTrees.printMessage(JavacTrees.java:1239) at jdk.javadoc/jdk.javadoc.internal.doclint.Messages.report(Messages.java:129) at jdk.javadoc/jdk.javadoc.internal.doclint.Checker.reportMissing(Checker.java:263) at jdk.javadoc/jdk.javadoc.internal.doclint.Checker.scan(Checker.java:188) at jdk.javadoc/jdk.javadoc.internal.doclint.DocLint.scan(DocLint.java:348) at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.BaseConfiguration.runDocLint(BaseConfiguration.java:713) at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getDocCommentTree0(Utils.java:2664) at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.util.Utils.getDocCommentTree(Utils.java:2734) at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.MemberSummaryBuilder$PropertyHelper.addToPropertiesMap(MemberSummaryBuilder.java:489) at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.MemberSummaryBuilder$PropertyHelper.computeProperties(MemberSummaryBuilder.java:481) at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.MemberSummaryBuilder$PropertyHelper.<init>(MemberSummaryBuilder.java:470) at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.MemberSummaryBuilder.<init>(MemberSummaryBuilder.java:89) at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.MemberSummaryBuilder$1.<init>(MemberSummaryBuilder.java:102) at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.MemberSummaryBuilder.getInstance(MemberSummaryBuilder.java:102) at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.BuilderFactory.getMemberSummaryBuilder(BuilderFactory.java:212) at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.ClassBuilder.buildMemberSummary(ClassBuilder.java:327) at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.ClassBuilder.buildClassDoc(ClassBuilder.java:148) at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.builders.ClassBuilder.build(ClassBuilder.java:113) at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDoclet.generateClassFiles(HtmlDoclet.java:388) at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.generateClassFiles(AbstractDoclet.java:286) at jdk.javadoc/jdk.javadoc.internal.doclets.formats.html.HtmlDoclet.generateClassFiles(HtmlDoclet.java:199) at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.startGeneration(AbstractDoclet.java:212) at jdk.javadoc/jdk.javadoc.internal.doclets.toolkit.AbstractDoclet.run(AbstractDoclet.java:115) at jdk.javadoc/jdk.javadoc.doclet.StandardDoclet.run(StandardDoclet.java:103) at jdk.javadoc/jdk.javadoc.internal.tool.Start.parseAndExecute(Start.java:556) at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:393) at jdk.javadoc/jdk.javadoc.internal.tool.Start.begin(Start.java:342) at jdk.javadoc/jdk.javadoc.internal.tool.Main.execute(Main.java:63) at jdk.javadoc/jdk.javadoc.internal.tool.Main.main(Main.java:52)
09-07-2021