duration.getSeconds() is a decomposition API which should always be used alongside duration.getNano(). duration.toSeconds() is a conversion API, and the preferred way to convert to seconds.
Suppress false positives by adding the suppression annotation @SuppressWarnings("JavaDurationGetSecondsToToSeconds")
to the enclosing element.