A field name differs from a method name only in case

tx0/java:names-differ-by-casestrictwarningsmell

What it finds

A class with a field URL and a method url() has names that are easy to mix up when reading or completing code.

Reported is a field whose name differs from a method of the same class only in case. Names that are the same, as a field name and its accessor name(), are fine.

From the rule's source, member_names_differ_by_case.rs.

Example from the rule's tests
class Link {  private String URL;tx0 reports: the field URL differs from the method url only in case  private String name;  private Link link;   String url() {    return URL;  }   String name() {    return name;  }}
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:names-differ-by-case" = "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:names-differ-by-case] reason="..."

tx0 explain tx0/java:names-differ-by-case shows the same in the terminal. Found a false positive? Report it.