Why does IntelliJ IDEA give a warning that this file javadoc is dangling?

Just in case, if you are interested in removing this dangling JavaDoc comment inspection, you can do so by disabling that from:

  1. Open preferences
  2. Navigate to Editor --> Inspections
  3. Under the menu list on right, select Java --> JavaDoc
  4. Uncheck "Dangling Javadoc comment"

Remove Dangling Javadoc comment inspection


You will also see this if you placed the Javadoc comment after any annotations.

For example:

@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@SuppressWarnings({"unused", "WeakerAccess"})
/**  --> Dangling Javadoc warning.
 * This class does great and wonderful things.
 */
public class ClassThatDoesStuff {
}

Instead, the Javadoc must precede everything to receive the "No errors found in this file" seal of approval:

/**
 * This class does great and wonderful things.
 */
@Data
@JsonInclude(JsonInclude.Include.NON_NULL)
@SuppressWarnings({"unused", "WeakerAccess"})
public class ClassThatDoesStuff {
}