[threeten-dev] the "deduplicate" mechanism in tzdb compiler
Stephen Colebourne
scolebourne at joda.org
Sun Jan 20 15:22:50 PST 2013
The purpose was to deduplicate objects within other objects.
If this patch produces a tzdb.jar file with exactly the same data,
then its fine by me.
Stephen
On 20 January 2013 19:53, Xueming Shen <xueming.shen at oracle.com> wrote:
> The "deduplicate" mechanism in tzdb compiler looks really fishy, so I
> took a look into how it really works. It turns out this is really something
> not necessary, at least for the compiler tool we are looking for here.
> All those date/time, offset, trans, transruls will be thrown out at the end,
> why should we care about whether they are dup or not? they have been
> created anyway. The only thing we really care here is the ZoneRules
> which will be output to the tzdb.jar, they need to be de-duplicated
> before written out. But this is being done perfectly at outputFile(s) via
> the combination of
>
> Set<ZoneRules> loopAllRules = new HashSet<ZoneRules>(builtZones.values());
> ...
> List<ZoneRules> rulesList = new ArrayList<>(allRules);
> ...
> int rulesIndex = rulesList.indexOf(entry.getValue());
>
> The HashSet, ArrayList.indexOf() works on ZoneRules.equals() so
> the ZoneRules objects are being effectively de-duplicated without
> any help from that "deduplicate" mechanism.
>
> http://cr.openjdk.java.net/~sherman/jdk8_threeten/zruleDup2
>
> -Sherman
More information about the threeten-dev
mailing list