An interface declares only constants
What it finds
An interface that holds only constants exists so that classes can implement it to use the names without a qualifier. The constants then become part of the public type of every implementing class and its subclasses. A final class with a private constructor, or static imports, give the short names without that.
From the rule's source, constant_interface.rs.
interface Limits {tx0 reports: Limits declares only constants int MAX = 10; int MIN = 0;} interface Shape { int SIDES = 0; int area();} 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:
[rules]
"tx0/java:constant-interface" = "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:constant-interface] reason="..."tx0 explain tx0/java:constant-interface shows the same in the terminal. Found a false positive? Report it.