Repository: jenkinsci/jenkins
File: core/src/main/java/jenkins/util/SystemProperties.java (Java)

Code before:
    @CheckForNull
    public static Duration getDuration(@NonNull String name) {
        return getDuration(name, null);
    }

    /**
     * Determines the duration value of the system property with the specified name, or a default value.
     * @param name property name.
     * @param defaultValue a default value
     * @return the property value as a duration.
     * @since TODO
     */
    @Nullable
    public static Duration getDuration(@NonNull String name, @CheckForNull Duration defaultValue) {
        return getDuration(name, defaultValue, Level.CONFIG);
    }

    /**
     * Determines the duration value of the system property with the specified name, or a default value.
     * @param name property name.
     * @param defaultValue a default value
     * @param logLevel the level of the log if the provided system property name cannot be parsed into Duration.
     * @return the property value as a duration.
     */
    @Nullable
    public static Duration getDuration(@NonNull String name, @CheckForNull Duration defaultValue, @NonNull Level logLevel) {
        String v = getString(name);
        if (v != null) {
            try {
                return DurationStyle.detectAndParse(v);
            } catch (Exception e) {
                LOGGER.log(logLevel, e, () -> "Property. Value is not a duration: " + name + " => " + v);
            }
        }
        return defaultValue;
    }

    /**
      * Determines the integer value of the system property with the
      * specified name.
      *
      * This behaves just like {@link Integer#getInteger(java.lang.String)}, except that it
      * also consults the {@link ServletContext}'s "init" parameters.
      *
      * @param   name property name.
      * @return  the {@code Integer} value of the property.
      */
    @CheckForNull
    public static Integer getInteger(String name) {
        return getInteger(name, null);
    }

Review comment (suggestion):
Last I checked, you cannot use `@Nullable` any more: https://github.com/jenkinsci/plugin-pom/issues/1063

Code after:
     */
    @CheckForNull
    public static Duration getDuration(@NonNull String name) {
        return getDuration(name, (Duration) null);
    }

    /**
     * Determines the duration value of the system property with the specified name.
     * @param name property name.
     * @param unit the duration unit to use if the value doesn't specify one (defaults to `ms`)
     * @return the property value as a duration.
     * @since TODO
     */
    @CheckForNull
    public static Duration getDuration(@NonNull String name, @CheckForNull ChronoUnit unit) {
        return getDuration(name, unit, null);
    }

    /**
     * Determines the duration value of the system property with the specified name, or a default value.
     * @param name property name.
     * @param defaultValue a default value
     * @return the property value as a duration.
     * @since TODO
     */
    @Nullable
    public static Duration getDuration(@NonNull String name, @CheckForNull Duration defaultValue) {
        return getDuration(name, null, defaultValue);
    }

    /**
     * Determines the duration value of the system property with the specified name, or a default value.
     *
     * @param name         property name.
     * @param unit         the duration unit to use if the value doesn't specify one (defaults to `ms`)
     * @param defaultValue a default value
     * @return the property value as a duration.
     * @since TODO
     */
    @Nullable
    public static Duration getDuration(@NonNull String name, @CheckForNull ChronoUnit unit, @CheckForNull Duration defaultValue) {
        String v = getString(name);
        if (v != null) {
            try {
                return DurationStyle.detectAndParse(v, unit);
            } catch (Exception e) {
                LOGGER.log(Level.WARNING, e, () -> "Failed to convert \"%s\" to a valid duration for property \"%s\", falling back to default \"%s\"".formatted(v, name, defaultValue));
            }
        }
        return defaultValue;
    }