JDK-8275199 : Bogus warning generated for serializable records
  • Type: Bug
  • Component: tools
  • Sub-Component: javadoc(tool)
  • Affected Version: 15.0.2,17,18
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2021-10-12
  • Updated: 2021-11-15
  • Resolved: 2021-11-08
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 b23Fixed
Related Reports
Relates :  
Relates :  
Description
A DESCRIPTION OF THE PROBLEM :
When a record implements an interface, javadoc issues bogus warnings.

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run javadoc for the class below (simply "javadoc Point.java")


EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
No warnings.
ACTUAL -
Two warnings:
Point.java:7: warning: no comment
public record Point(double x, double y) implements java.io.Serializable {
                           ^
Point.java:7: warning: no comment
public record Point(double x, double y) implements java.io.Serializable {

---------- BEGIN SOURCE ----------
/**
 * Comment.
 * 
 * @param x comment
 * @param y comment
 */
public record Point(double x, double y) implements java.io.Serializable {
}
---------- END SOURCE ----------

FREQUENCY : always



Comments
Changeset: e383d263 Author: Jonathan Gibbons <jjg@openjdk.org> Date: 2021-11-08 19:13:22 +0000 URL: https://git.openjdk.java.net/jdk/commit/e383d263610c7b4d4be2dce599a9043b8f76cd64
08-11-2021

The warning is generated with a compact constructor that does not use Serializable. An example is at https://bugs.openjdk.java.net/browse/JDK-8275784
22-10-2021

If you wish to investigate warnings when records implement other interfaces, please provide additional examples.
21-10-2021

The issue is specific to records that implement Serializable, not any interface. This is covered by 1.13 Serialization of Records https://docs.oracle.com/en/java/javase/17/docs/specs/serialization/serial-arch.html#serialization-of-records javadoc should not attempt to document the fields of a serializable record. When that is fixed, the warnings will go away.
21-10-2021

Unlike JDK-8275192, this issue is worth investigating. It is probable that the issue comes from the generated private fields, which should be taken into account when reporting missing comments. Effectively, the `@param` comments should be treated as if they also applied to the private fields of the record.
21-10-2021

Reproducible since JDK 15. Following is my observation: 1. JDK 14 - pass 2. JDK 15-ea+1-2 - pass 3. JDK 15.0.2+7-27 - warning is generated 4. JDK 15 b36 - warning is generated 5. JDK 17- warning is generated 6. JDK 18- warning is generated
13-10-2021