Skip to content

Invalid formatter whitespace with record component annotation using an array value #477

Description

@christophejan

I suspect a source-formatter bug when a record component is annotated and its value element is an array type.

Using spring-javaformat-maven-plugin:0.0.47, the code is formatted as:

public record SomeRecord(@SomeAnnot( {
"v1", "v2" }) String elt){
}

Checkstyle then reports two violations:

  • SpringParenPad - whitespace before the annotation array element.
  • WhitespaceAround - missing whitespace between the closing parenthesis of the record declaration and the record opening brace.

Expected formatting (similar to an annotation on a method parameter):

public record SomeRecord(@SomeAnnot({ "v1", "v2" }) String elt) {
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions