Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Four spacesNOT a tab character, is are used for regular indentation. For code broken into multiple lines, eight spaces are used indent lines after the first:

    Code Block
    languagejava
    if (obj instanceof DefaultDevice) {
        return Objects.equals(this.id, other.id) &&
                Objects.equals(this.type, other.type) &&
                Objects.equals(this.manufacturer, other.manufacturer);


  • If the line has to break at the dot separator ".", the dot symbol should be at the beginning of the next line:
     

    Code Block
    languagejava
    public void describeTo(Description description) {
        description.appendText("status '")
                   .appendText(status.getDescription())
                   .appendText("'");
    }


  • Trailing whitespaces should be removed in both code and comments.
  • There should be a space between keywords (ifforcatch, etc.), parenthesis, and braces, as well as when casting:

    Code Block
    languagejava
    if (timer != null) {
        try {
            DeviceId did = (DeviceId) elementId;
            ...
        } catch (IOException e) {
    ...
  • There should be a space before the curly braces in method definitions. Arguments are not padded (neither in definition nor invocation):

    Code Block
    languagejava
    public Device getDevice(DeviceId deviceId) {
        return store.getDevice(deviceId);
    }

...