Adding or subtracting a number and itself
Open
- Dominant language
- Java
- Stars
- 7.2k
- Forks
- 820
- Avg merge
- 5h 9m
- Merged PRs (30d)
- 50
Description
Over a year ago, I ran a check over Google code for two patterns:
- `x - x`
- `(x + x) / 2` (but probably even `x + x` is suspicious)
Results are in internal CL 49788955. I see some of the same kinds of things you see for `x == x` (e.g., `foo1.getX() - foo1.getX()` instead of `foo1.getX() - foo2.getX()`). I also see some people using bad date APIs that require January = 0, for which they write `1 - 1` for January, `12 - 1` for December, etc. There may be other patterns where we wouldn't want to do this. Maybe we can just throw out anything with literals?
Contributor guide
Assessment
This issue has not been assessed yet.