Skip to content

clang-format inserts pointless newline after Java "public record" when BinPackParameters false #62089

Closed
@sh-at-cs

Description

@sh-at-cs

Consider a Java file MyRecord.java:

public record MyRecord(
    String s1, String s2, String s3, String s4, String s5, String s6
) {
}

With BinPackParameters: false, clang-format formats this like this:

public record
MyRecord(String s1, String s2, String s3, String s4, String s5, String s6) {}

I don't think putting public record on its own line is intentional (it doesn't do this with a public class instead of a record). Most likely it just doesn't understand record types in Java (which were introduced in Java 14) and does something weird as a result.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions