--- old/src/java.base/share/classes/java/time/LocalDate.java 2016-01-07 12:12:42.421149740 +0300 +++ new/src/java.base/share/classes/java/time/LocalDate.java 2016-01-07 12:12:42.201149740 +0300 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1369,6 +1369,20 @@ if (daysToAdd == 0) { return this; } + long dom = day + daysToAdd; + if (dom > 0 && dom <= 28) { + return LocalDate.of(year, month, (int) dom); + } else if (dom > 28 && dom <= 59) { // 59th Jan is 28th Feb, 59th Feb is 31st Mar + long monthLen = lengthOfMonth(); + if (dom <= monthLen) { + return LocalDate.of(year, month, (int) dom); + } else if (month < 12) { + return LocalDate.of(year, month + 1, (int) (dom - monthLen)); + } else { + return LocalDate.of(year + 1, 1, (int) (dom - monthLen)); + } + } + long mjDay = Math.addExact(toEpochDay(), daysToAdd); return LocalDate.ofEpochDay(mjDay); }