A modifier states what the language already implies

tx0/java:implied-modifierstrictwarningstyle

What it finds

Some modifiers say what the language already implies, and only add words:

- public and abstract on the methods of an interface, and public, static and final on its fields and public and static on its member types; - static on an interface, enum or record declared inside another type; - final on a record, and private on the constructor of an enum; - final on a method of a final class or on a private method.

The fix removes the modifier.

From the rule's source, redundant_modifier.rs.

Example from the rule's tests
interface Shape {  public static final int SIDES = 0;tx0 reports: public static final are redundant here: interface fields are public, static and final  public abstract int area();tx0 reports: public abstract are redundant here: interface methods are public and abstract unless they have a body  default int twice() {    return 2 * area();  }} class Outer {  static enum Kind { A }tx0 reports: static is redundant here: nested interfaces, enums and records are static  static class Inner {}  private final void helper() {}tx0 reports: final is redundant here: private methods are never overridden} enum Color {  RED;  private Color() {}tx0 reports: private is redundant here: enum constructors are private} final record Point(int x) {}tx0 reports: final is redundant here: records are final
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/java:implied-modifier" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/java:implied-modifier] reason="..."

tx0 explain tx0/java:implied-modifier shows the same in the terminal. Found a false positive? Report it.