Closed jodastephen closed 11 years ago
With the following changes we currently put in -j.u.TimeZone now shares the tzdb.jar -java.time.zone.DefaultZoneRulesProvider system provider for default zrules provider It appears most of the issues mentioned above have been solved. The only things left seem to be
(1) whether or not the j.u.TimeZone should also use the zone data if the default provider is something other than the default. This might be something "nice to have". But I don't think it's a must, and probably it's not going to happen in jdk8 timeframe.
(2) how to support #7. I don't think "specifying the file format" and/or "make tzdb compiler public" are the best and desired choice. The ZoneRulesProvider class is designed exactly for this purpose (with the newly added DefaultZoneRulesProvider system property). Any "customized" zone rules support could/should just go via this SPI interface, Implement your customized "provider" and then specified it as the default zonerules provider.
I agree that we have most of this now. Here are the problems:
It seems that ZoneInfoFile does not respect the default provider system property. That makes it more likely that the TimeZone
implementation will be out of line with ZoneId
creating confusion. Could ZoneInfoFile use ZoneRulesProvider internally, so data is only loaded once from the file?
Point 7 (data format) is not a problem if the default provider mechanism works fully.
The system property approach is quite difficult to use in some setups. The cases are:
The first case is easy. The second case is more interesting. Ideally, they should just have to download a jar from Oracle or Maven and add it to their classpath (possibly bootclasspath). Has the mechanism for this been agreed yet (currently its the tzupdater tool).
For the third case, I think users can manage to set a system property. But really, they want their changes to affect both ZoneId and TimeZone, which isn't the case right now.
The code uses the property java.time.zone.DefaultZoneRulesProvider
with the ClassLoader.getSystemClassLoader()
. If I understand correctly, this means that applications cannot just include their own provider in the regular application classpath. Does it need to be the system class loader?
The "system class loader" is the application class loader, it will/should lookup the targeted class from boot-cp, ext-cp and then the app-cp.
Good that the applciation class loader can be used.
The most practical way to get up to date TimeZone
might be for ZoneRulesProvider
to be able to provide instances of TimeZone
. The default implementation would use ZoneInfoFile
. It would more closely link the old code with the new code.
Closing as we're not doing this now.
The tzdb included in the JDK needs to be easily replaced/supplemented. must vs nice to have list:
java.util.TimeZone
.ZoneId
andTimeZone
.java.util.TimeZone
class depend onZoneId
internally to eliminate two sets of data in the JDK. This may require additional public methods onZoneId
.ZoneId
classes with a set of data that includes the full historical set of tzdb data. If (3) is implemented, then this will also affectTimeZone
. Note that this requirement effectively allows a user to update the time-zone data without using the TZUpdater tool (or equivalent).ZoneId
, if notTimeZone
, with a provider that loads and updates the data over the network dynamically. While we may disagree on the benefits of this approach, we must not prevent it. Again, I would note that being able to replace the default provider would meet this requirement, but is not the only option.ZoneOffset
IDs.See also #197 on leap seconds, which are held in the same file.