SONARJAVA-6345 Create rule S8695: Redundant time instantiation patterns should be simplified#5635
Conversation
Agentic Analysis: Early ResultsAgentic Analysis and Context Augmentation are available on your project. Here are some issues that could have been prevented. Follow the links to learn how to put them into action. 12 issue(s) found across 1 file(s):
Analyzed by SonarQube Agentic Analysis in 5.4 s |
0588649 to
afa65df
Compare
.from(Instant.now()) with .now()6529041 to
770f91a
Compare
|
Code Review ✅ Approved 4 resolved / 4 findingsImplements rule S8695 to simplify redundant java.time instantiations, with refined quick-fixes and corrected test assertions for ZonedDateTime and OffsetDateTime patterns. No outstanding issues remain. ✅ 4 resolved✅ Bug: quickfix field should be "targeted" not "unknown"
✅ Bug: Issue message is inaccurate for Instant.now() case (no ZoneId)
✅ Bug: Incorrect quickfix for Instant.now(clock).atZone(zoneId) pattern
✅ Bug: Stray
|
| Auto-apply | Compact |
|
|
Was this helpful? React with 👍 / 👎 | Gitar




Summary by Gitar
SimpleTemporalInstantiationCheck(S8695) to simplify verbosejava.timeobject instantiations.LocalDate.from(Instant.now())that should be replaced withLocalDate.now().now()andnow(clock)patterns.ZonedDateTimeandOffsetDateTimeexpressions.This will update automatically on new commits.