JavaDurationGetSecondsToToSeconds rule is misleading and possibly harmful
Open
- Dominant language
- Java
- Stars
- 7.2k
- Forks
- 820
- Avg merge
- 5h 9m
- Merged PRs (30d)
- 50
Description
### Expected Behavior
`toSeconds()` accounts for seconds *and* nanos, unlike `getSeconds()`. This is confirmed by AI Overview (screenshot below).
### Actual Behavior
`toSeconds()` is implemented by `return seconds;` all the way to JDK 25. Hence, `getSeconds()` and `toSeconds()` return identical result. The way the rule is phrased may lead the user to believe these results are different and cause errors when a "conversion" is attempted.
### Screenshot
Interestingly, this AI Overview seems to be using the `JavaDurationGetSecondsToToSeconds` rule text to generate the advice, thus possibly creating a circular hallucination.
Contributor guide
Assessment
This issue has not been assessed yet.