|
1 | 1 | /* |
2 | | - * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. |
| 2 | + * Copyright (c) 2012, 2026, Oracle and/or its affiliates. All rights reserved. |
3 | 3 | * Copyright (c) 2025, Alibaba Group Holding Limited. All Rights Reserved. |
4 | 4 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
5 | 5 | * |
|
87 | 87 | import java.util.concurrent.ConcurrentHashMap; |
88 | 88 | import java.util.concurrent.ConcurrentMap; |
89 | 89 | import java.util.concurrent.atomic.AtomicReferenceArray; |
| 90 | +import java.util.function.Supplier; |
90 | 91 |
|
91 | 92 | import jdk.internal.util.DecimalDigits; |
92 | | -import jdk.internal.vm.annotation.Stable; |
93 | 93 |
|
94 | 94 | /** |
95 | 95 | * A time-zone offset from Greenwich/UTC, such as {@code +02:00}. |
@@ -178,8 +178,13 @@ public final class ZoneOffset |
178 | 178 | /** |
179 | 179 | * The zone rules for an offset will always return this offset. Cache it for efficiency. |
180 | 180 | */ |
181 | | - @Stable |
182 | | - private transient ZoneRules rules; |
| 181 | + private final transient LazyConstant<ZoneRules> rules = |
| 182 | + LazyConstant.of(new Supplier<ZoneRules>() { |
| 183 | + @Override |
| 184 | + public ZoneRules get() { |
| 185 | + return ZoneRules.of(ZoneOffset.this); |
| 186 | + } |
| 187 | + }); |
183 | 188 |
|
184 | 189 | //----------------------------------------------------------------------- |
185 | 190 | /** |
@@ -521,11 +526,7 @@ public String getId() { |
521 | 526 | */ |
522 | 527 | @Override |
523 | 528 | public ZoneRules getRules() { |
524 | | - ZoneRules rules = this.rules; |
525 | | - if (rules == null) { |
526 | | - rules = this.rules = ZoneRules.of(this); |
527 | | - } |
528 | | - return rules; |
| 529 | + return rules.get(); |
529 | 530 | } |
530 | 531 |
|
531 | 532 | @Override |
|
0 commit comments