Duration’s withSeconds(long) method is often a source of bugs because it returns a copy of the current Duration instance, but only the seconds field is mutated (the nanos field is copied directly). Use Duration.ofSeconds(seconds, duration.getNano()) instead.
Suppress false positives by adding the suppression annotation @SuppressWarnings("JavaDurationWithSeconds")
to the enclosing element.