FlowingCode / DevelopmentConventions

Repository hosting conventions, decisions and documentation related to best coding practices that can be utilized in development projects
Apache License 2.0
7 stars 0 forks source link

Javadoc style guide: when to use `{@code}` #40

Open javier-godoy opened 3 weeks ago

javier-godoy commented 3 weeks ago

In each comment, the first occurrence of an identifier that refers to a class, field, or method must be enclosed in a {@link} tag. Otherwise, the identifier must be wrapped in {@code} (or <code> see #39).

The following identifiers must never be linked and should always be wrapped in {@code}:

  /**
   * Creates a new instance of {@code FooBar}.
   */
  public FooBar() { ... }
elPeiretti commented 3 weeks ago

I agree, it makes the docs much easier to read compared to having it all in plain text.

elPeiretti commented 3 weeks ago

Regarding the second rule: The names of the field type, method return type, and argument types must never be linked.

I would also add: If mentioned, they must be wrapped in {@code}

  /*
   *  ....
   * @param picture the {@code Picture} to display in the frame.
   */
  public void setPicture(Picture picture) {}
javier-godoy commented 3 weeks ago

Regarding the second rule: The names of the field type, method return type, and argument types must never be linked.

I would also add: If mentioned, they must be wrapped in {@code}

+1. I added the following clarification:

- The following identifiers must never be linked: 
+ The following identifiers must never be linked and should always be wrapped in `{@code}:`