On Wed, 9 Jun 2021 15:41:59 GMT, Patrick Concannon <pconcan...@openjdk.org> wrote:
> Hi, > > Could someone please review my code for updating the code in the `java.time` > packages to make use of the switch expressions? > > Kind regards, > Patrick Looks good overall. Some misplaced comments. Also, copyright years should be updated. src/java.base/share/classes/java/time/LocalDateTime.java line 1188: > 1186: case HOURS -> plusHours(amountToAdd); > 1187: case HALF_DAYS -> plusDays(amountToAdd / > 256).plusHours((amountToAdd % 256) * 12); > 1188: default -> with(date.plus(amountToAdd, unit), time); // > no overflow (256 is multiple of 2) The comment is misplaced. src/java.base/share/classes/java/time/chrono/ChronoLocalDateTimeImpl.java line 310: > 308: case HOURS -> plusHours(amountToAdd); > 309: case HALF_DAYS -> plusDays(amountToAdd / > 256).plusHours((amountToAdd % 256) * 12); > 310: default -> with(date.plus(amountToAdd, unit), time); // > no overflow (256 is multiple of 2) Misplaced comment here too. src/java.base/share/classes/java/time/format/SignStyle.java line 127: > 125: boolean parse(boolean positive, boolean strict, boolean fixedWidth) { > 126: return switch (ordinal()) { > 127: // valid if negative or (positive and lenient) The comment should apply only to the `case 0`. ------------- PR: https://git.openjdk.java.net/jdk/pull/4433