Published March 30, 2010 | https://doi.org/10.59350/27xt0-12j30

Cleaner CDK Code #4: inheriting JavaDoc from super classes and interfaces

Creators & Contributors

When you write a class implementing an interface or extending a super class, it is often the case that the API is identical. It would be nice to inherit the JavaDoc documentation, which is possible.

Inheriting JavaDoc

Java method that overwrite a superclass method or implement an interface method, can inherit JavaDoc by including this JavaDoc for that method:

/** {@inheritDoc} */
@TestMethod("testGetMIMEType")
public String getMIMEType() {
  return null;
}

The JavaDoc documentation notes that missing @param and @return values are inherited implicitly since JavaDoc 1.3, but I have never noticed this in Java6. The above explicit markup is confirmed to work.

Additional details

Description

When you write a class implementing an interface or extending a super class, it is often the case that the API is identical. It would be nice to inherit the JavaDoc documentation, which is possible.

Dates

Issued
2010-03-30T02:00:00
Updated
2010-03-30T02:00:00