On Tue, 21 Mar 2023 07:25:38 GMT, Per Minborg <pminb...@openjdk.org> wrote:

>> src/java.base/share/classes/java/time/ZoneOffset.java line 430:
>> 
>>> 428:     public static ZoneOffset ofTotalSeconds(int totalSeconds) {
>>> 429:         final class Holder {
>>> 430:             private static final IntFunction<ZoneOffset> 
>>> ZONE_OFFSET_MAPPER = new ZoneOffsetMapper();
>> 
>> Can't the ZoneOffsetMapper itself serve as a holder class? so we move this 
>> singleton into ZoneOffsetMapper itself.
>
> It is possible but this keeps the mapper more local and only accessible where 
> it is supposed to be used. For testing purposed, it might be better to have 
> the class as you propose.

If we want it local, I suppose we can convert the whole `ZoneOffsetMapper` 
local with this singleton in `ofTotalSeconds` static method as well.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/12346#discussion_r1143415419

Reply via email to