Skip to content

[clang-format] Wrongly formats a Java line that contains record keyword #159937

@biodranik

Description

@biodranik

With code style for braces on a new line, disabling clang-format or removing the record keyword helps:

  // clang-format off
  private record PathEntry(CountryItem item, boolean myMapsMode, int topPosition, int topOffset)
  {
    @Override
    public String toString()
    {
      return item.id + " (" + item.name + "), " + "myMapsMode: " + myMapsMode + ", topPosition: "
          + topPosition + ", topOffset: " + topOffset;
    }
  }
  // clang-format on

Otherwise, it formats like this:

  private record PathEntry(CountryItem item, boolean myMapsMode, int topPosition, int topOffset) {
    @Override
    public String toString()
    {
      return item.id + " (" + item.name + "), " + "myMapsMode: " + myMapsMode + ", topPosition: "
          + topPosition + ", topOffset: " + topOffset;
    }
  }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions