Hello! When testing our static analyzer, I've found obviously erroneous code in java.util.JapaneseImperialCalendar::actualMonthLength
int eraIndex = getTransitionEraIndex(jdate); if (eraIndex == -1) { long transitionFixedDate = sinceFixedDates[eraIndex]; CalendarDate d = eras[eraIndex].getSinceDate(); if (transitionFixedDate <= cachedFixedDate) { length -= d.getDayOfMonth() - 1; } else { length = d.getDayOfMonth() - 1; } } if this 'if' statement is visited then sinceFixedDates[eraIndex] will surely fail with ArrayIndexOutOfBoundsException. However, judging from the usages of this method, eraIndex is never -1 here, so the whole 'if' statement is a dead code. I'm not sure whether it should be removed, or the condition should be changed to 'eraIndex != -1' (and probably some unit-tests should be written to cover this). I have no expertise in this code so I'm not sure what would be a proper way to fix it. Please take a look. With best regards, Tagir Valeev.