RFR: 8066644: Fix deprecation warnings in jdk.zipfs module

Claes Redestad claes.redestad at oracle.com
Tue Oct 27 14:09:03 UTC 2015



On 2015-10-27 14:40, Aleksey Shipilev wrote:
> On 10/24/2015 11:54 PM, Claes Redestad wrote:
>> webrev: http://cr.openjdk.java.net/~redestad/8066644/webrev.02
>> bug: https://bugs.openjdk.java.net/browse/JDK-8066644
> Looks good.
>
> Is there really no way to use the new DateTime API, and ditch the
> multiplication by 1000L here?
>
>   116  return ldt.toEpochSecond(
>   117    ZoneId.systemDefault().getRules().getOffset(ldt)) * 1000L;

I guess using java.util.concurrent.TimeUnit might suffice:

return TimeUnit.MILLISECONDS.convert(ldt.toEpochSecond(...), 
TimeUnit.SECONDS);

The idiomatic DateTime way I guess would be to do:

return Duration.ofSeconds(ldt.toEpochSecond(), 0).toMillis();

I'll take these for a spin; properly inlined either variant might be 
performance neutral.

/Claes

>
> Thanks,
> -Aleksey
>
>




More information about the core-libs-dev mailing list