RFR: 8313231: Redundant if statement in ZoneInfoFile

Stephen Colebourne scolebourne at openjdk.org
Mon Jul 31 07:13:45 UTC 2023


On Thu, 27 Jul 2023 11:01:23 GMT, Pavel Rappo <prappo at openjdk.org> wrote:

>> if (i < savingsInstantTransitions.length) {
>>     // javazic writes the last GMT offset into index 0!
>>     if (i < savingsInstantTransitions.length) {
>>         offsets[0] = standardOffsets[standardOffsets.length - 1] * 1000;
>>         nOffsets = 1;
>>     }
>>     ...
>> }
>> 
>> 
>> The second if statement looks unnecessary.
>
> src/java.base/share/classes/sun/util/calendar/ZoneInfoFile.java line 471:
> 
>> 469:             if (i < savingsInstantTransitions.length) {
>> 470:                 // javazic writes the last GMT offset into index 0!
>> 471:                 if (i < savingsInstantTransitions.length) {
> 
> Even my IDE flags it as always true. While it surely is redundant, I wonder if some other check was intended instead. @jodastephen?

I'm not sure this is my code - I certainly don't remember it. This PR causes no effective change but be slightly neater, so I guess I approve the PR

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/15052#discussion_r1278874277


More information about the core-libs-dev mailing list