Inconsistencies between Checkstyle rule and formatter for records
I encountered an inconsistency between Checkstyle and the Eclipse formatter using a Java record class.
Consider the following small example that is accepted by Checkstyle:
public record Example(int a, String s) {
/** Some documentation. */
private static int b = 10;
/**
* Constructor for the Example class.
*/
public Example(String s) {
this(1, s);
}
}
The formatter changes this into
public record Example(int a, String s) {
/** Some documentation. */
private static int b = 10;
/**
* Constructor for the Example class.
*/
public Example(String s) {
this(1, s);
}
}
on which Checkstyle complains with 'CTOR_DEF' should be separated from previous statement.
I personally prefer the first style.