I have downloaded the latest checkstyle from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, as cli describes the problem better than 1,000 words
From: https://google.github.io/styleguide/javaguide.html#s6.1-override-annotation
A method is marked with the @Override annotation whenever it is legal. This includes ... and an explicitly declared accessor method for a record component
Code:
import java.util.Locale;
/** some javadoc. */
public record InputOverrideAlwaysUsedForRecord(String name, int age) {
/** some javadoc. */
public String name() { // Expected violation
return name.toUpperCase(Locale.ROOT);
}
}
record Container(String fileName, int port) {
public int port() { // Expected violation
return port;
}
}
Cli:
$ java -jar checkstyle-10.26.1-all.jar -c google_checks.xml InputOverrideAlwaysUsedForRecord.java
Starting audit...
Audit done.
Expected: two violations
I have downloaded the latest checkstyle from: https://checkstyle.org/cmdline.html#Download_and_Run
I have executed the cli and showed it below, as cli describes the problem better than 1,000 words
From: https://google.github.io/styleguide/javaguide.html#s6.1-override-annotation
Code:
Cli:
Expected: two violations