--- a/jdk/src/share/classes/java/time/LocalDateTime.java Fri Oct 04 16:05:55 2013 +0100
+++ b/jdk/src/share/classes/java/time/LocalDateTime.java Thu Aug 29 20:38:46 2013 +0100
@@ -1129,6 +1129,11 @@
*/
@Override
public LocalDateTime plus(TemporalAmount amountToAdd) {
+ Objects.requireNonNull(amountToAdd, "amountToAdd");
+ if (amountToAdd instanceof Period) {
+ Period periodToAdd = (Period) amountToAdd;
+ return with(date.plus(periodToAdd), time);
+ }
return (LocalDateTime) amountToAdd.addTo(this);
}
@@ -1343,6 +1348,11 @@
*/
@Override
public LocalDateTime minus(TemporalAmount amountToSubtract) {
+ Objects.requireNonNull(amountToSubtract, "amountToSubtract");
+ if (amountToSubtract instanceof Period) {
+ Period periodToSubtract = (Period) amountToSubtract;
+ return with(date.minus(periodToSubtract), time);
+ }
return (LocalDateTime) amountToSubtract.subtractFrom(this);
}