From 545232502cefa9807a960057836138c1d4e21d1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Galder=20Zamarren=CC=83o?= Date: Wed, 1 Jul 2020 14:21:29 +0200 Subject: [PATCH] Keep image zone rules cache separate #2637 * Before this patch, the image would contain zone rules cache from the JVM computing the image. * Side effects here, such as class or source cache lookups, were affecting its contents and leading to error when writing image. * With this change, we guarantee that the zone rules cache in the image is a brand new instance, separate from the one in the JVM computing the image. --- .../svm/core/jdk/TimeSubstitutions.java | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/TimeSubstitutions.java diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/TimeSubstitutions.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/TimeSubstitutions.java new file mode 100644 index 0000000000000..638e64d9875f2 --- /dev/null +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/jdk/TimeSubstitutions.java @@ -0,0 +1,23 @@ +package com.oracle.svm.core.jdk; + +import com.oracle.svm.core.annotate.Alias; +import com.oracle.svm.core.annotate.RecomputeFieldValue; +import com.oracle.svm.core.annotate.TargetClass; + +import java.time.zone.ZoneOffsetTransition; +import java.time.zone.ZoneRules; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; + +@TargetClass(ZoneRules.class) +final class Target_java_time_zone_ZoneRules { + + @SuppressWarnings("unused") + @Alias + @RecomputeFieldValue(kind = RecomputeFieldValue.Kind.NewInstance, declClass = ConcurrentHashMap.class) + private transient ConcurrentMap lastRulesCache; + +} + +class TimeSubstitutions { +}