Missing Javadoc
ID |
java.missing_javadoc |
Severity |
low |
Remediation Complexity |
trivial |
Remediation Risk |
low |
Remediation Effort |
low |
Resource |
Documentation |
Language |
Java |
Tags |
best-practice, documentation |
Description
Reports declarations that lack a Javadoc comment or whose Javadoc is missing required tags.
Public APIs should be documented with Javadoc so that consumers can understand the contract without reading the implementation. Missing @param, @return, or @throws tags force readers to guess parameter semantics, return values, and error conditions.
"Public" means the visibility keyword, not "everything that is not private". A package-private member is an implementation detail of its package and is not checked by default; a member of an interface or annotation type is public even though no keyword says so, and is.
|
This rule does not apply to files under paths configured in |
Rationale
-
Maintainability – Undocumented public APIs slow down onboarding and increase the chance of misuse.
-
Tooling – IDEs and documentation generators rely on Javadoc to provide inline help and API reference pages.
Configuration
The rule is fully configurable. Properties control which declarations require Javadoc and which tags must be present.
Declaration checks
| Property | Default | Description |
|---|---|---|
|
|
Require Javadoc on public classes, interfaces, enums, records |
|
|
Require Javadoc on protected types |
|
|
Require Javadoc on package-private types |
|
|
Require Javadoc on private types |
|
|
Require Javadoc on public methods and constructors |
|
|
Require Javadoc on protected methods |
|
|
Require Javadoc on package-private methods |
|
|
Require Javadoc on private methods |
|
|
Require Javadoc on public fields |
|
|
Require Javadoc on protected fields |
|
|
Require Javadoc on package-private fields |
|
|
Require Javadoc on private fields |
Exempt members
Four kinds of member carry no information a Javadoc comment could add. Each is exempt by default; set its property to true to require documentation anyway.
| Property | Default | Description |
|---|---|---|
|
|
Accessors and mutators. Recognised by the body — a method that does nothing but read or write one field — so fluent setters and builder methods count too |
|
|
Methods annotated |
|
|
Constructors with an empty body |
|
|
|
Tag requirements
When a method or constructor has Javadoc, these properties control which tags must be present.
| Property | Default | Description |
|---|---|---|
|
|
Require |
|
|
Require |
|
|
Require |
|
|
Require |
|
|
Require |
|
|
Require |
|
|
Require |