[java] ShortVariable false positives for generated/inherited methods parameters (e.g. equals)
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 5.5k
- Forks
- 1.6k
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 54
Description
Affects PMD Version:
6.53.0
Rule:
https://docs.pmd-code.org/latest/pmd_rules_java_codestyle.html#shortvariable
Description:
equals(Object o) and T t intercepted.
Code Sample demonstrating the issue:
@Override
1. public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
Dict dict = (Dict) o;
return code == dict.code;
}
2. boolean insert(T t);
Expected outcome:
idea auto generated equals(Object o) and T t, please ignore this,thanks.
Running PMD through: [Maven Plugin]
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked ShortVariable rule documentation and reproduce the reported equals(Object o) and insert(T t) examples through the Maven Plugin. Trace the rule's Java implementation and existing tests, if present; done means generated or inherited-method parameters no longer produce these false positives without weakening ordinary short-variable checks.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100