Internal change

PiperOrigin-RevId: 590871044
pull/15068/head
Protobuf Team Bot 1 year ago committed by Copybara-Service
parent 543fbcdbd9
commit 2d7376ea37
  1. 20
      java/util/src/main/java/com/google/protobuf/util/Durations.java
  2. 36
      java/util/src/main/java/com/google/protobuf/util/Timestamps.java

@ -426,13 +426,13 @@ public final class Durations {
* Add two durations. * Add two durations.
* *
* <!-- MOE:begin_intracomment_strip --> * <!-- MOE:begin_intracomment_strip -->
* <p>Do not use this method for new code. Instead, convert to {@link java.time.Duration} using * @deprecated Do not use this method for new code. Instead, convert to {@link java.time.Duration}
* {@link com.google.protobuf.util.JavaTimeConversions#toJavaDuration}, do the arithmetic there, * using {@link com.google.protobuf.util.JavaTimeConversions#toJavaDuration}, do the
* and convert back using {@link com.google.protobuf.util.JavaTimeConversions#toProtoDuration}. * arithmetic there, and convert back using {@link
* * com.google.protobuf.util.JavaTimeConversions#toProtoDuration}.
* <p>This method will be deprecated once most uses have been eliminated.
* <!-- MOE:end_intracomment_strip --> * <!-- MOE:end_intracomment_strip -->
*/ */
@Deprecated // MOE:strip_line
public static Duration add(Duration d1, Duration d2) { public static Duration add(Duration d1, Duration d2) {
checkValid(d1); checkValid(d1);
checkValid(d2); checkValid(d2);
@ -444,13 +444,13 @@ public final class Durations {
* Subtract a duration from another. * Subtract a duration from another.
* *
* <!-- MOE:begin_intracomment_strip --> * <!-- MOE:begin_intracomment_strip -->
* <p>Do not use this method for new code. Instead, convert to {@link java.time.Duration} using * @deprecated Do not use this method for new code. Instead, convert to {@link java.time.Duration}
* {@link com.google.protobuf.util.JavaTimeConversions#toJavaDuration}, do the arithmetic there, * using {@link com.google.protobuf.util.JavaTimeConversions#toJavaDuration}, do the
* and convert back using {@link com.google.protobuf.util.JavaTimeConversions#toProtoDuration}. * arithmetic there, and convert back using {@link
* * com.google.protobuf.util.JavaTimeConversions#toProtoDuration}.
* <p>This method will be deprecated once most uses have been eliminated.
* <!-- MOE:end_intracomment_strip --> * <!-- MOE:end_intracomment_strip -->
*/ */
@Deprecated // MOE:strip_line
public static Duration subtract(Duration d1, Duration d2) { public static Duration subtract(Duration d1, Duration d2) {
checkValid(d1); checkValid(d1);
checkValid(d2); checkValid(d2);

@ -431,13 +431,13 @@ public final class Timestamps {
* Calculate the difference between two timestamps. * Calculate the difference between two timestamps.
* *
* <!-- MOE:begin_intracomment_strip --> * <!-- MOE:begin_intracomment_strip -->
* <p>Do not use this method for new code. Instead, convert to {@link java.time.Instant} using * @deprecated Do not use this method for new code. Instead, convert to {@link java.time.Instant}
* {@link com.google.protobuf.util.JavaTimeConversions#toJavaInstant}, do the arithmetic there, * using {@link com.google.protobuf.util.JavaTimeConversions#toJavaInstant}, do the arithmetic
* and convert back using {@link com.google.protobuf.util.JavaTimeConversions#toProtoDuration}. * there, and convert back using {@link
* * com.google.protobuf.util.JavaTimeConversions#toProtoDuration}.
* <p>This method will be deprecated once most uses have been eliminated.
* <!-- MOE:end_intracomment_strip --> * <!-- MOE:end_intracomment_strip -->
*/ */
@Deprecated // MOE:strip_line
public static Duration between(Timestamp from, Timestamp to) { public static Duration between(Timestamp from, Timestamp to) {
checkValid(from); checkValid(from);
checkValid(to); checkValid(to);
@ -450,15 +450,14 @@ public final class Timestamps {
* Add a duration to a timestamp. * Add a duration to a timestamp.
* *
* <!-- MOE:begin_intracomment_strip --> * <!-- MOE:begin_intracomment_strip -->
* <p>Do not use this method for new code. Instead, convert to {@link java.time.Instant} and * @deprecated Do not use this method for new code. Instead, convert to {@link java.time.Instant}
* {@link java.time.Duration} using {@link * and {@link java.time.Duration} using {@link
* com.google.protobuf.util.JavaTimeConversions#toJavaInstant} and {@link * com.google.protobuf.util.JavaTimeConversions#toJavaInstant} and {@link
* com.google.protobuf.util.JavaTimeConversions#toJavaDuration}, do the arithmetic there, and * com.google.protobuf.util.JavaTimeConversions#toJavaDuration}, do the arithmetic there, and
* convert back using {@link com.google.protobuf.util.JavaTimeConversions#toProtoTimestamp}. * convert back using {@link com.google.protobuf.util.JavaTimeConversions#toProtoTimestamp}.
*
* <p>This method will be deprecated once most uses have been eliminated.
* <!-- MOE:end_intracomment_strip --> * <!-- MOE:end_intracomment_strip -->
*/ */
@Deprecated // MOE:strip_line
public static Timestamp add(Timestamp start, Duration length) { public static Timestamp add(Timestamp start, Duration length) {
checkValid(start); checkValid(start);
Durations.checkValid(length); Durations.checkValid(length);
@ -471,15 +470,14 @@ public final class Timestamps {
* Subtract a duration from a timestamp. * Subtract a duration from a timestamp.
* *
* <!-- MOE:begin_intracomment_strip --> * <!-- MOE:begin_intracomment_strip -->
* <p>Do not use this method for new code. Instead, convert to {@link java.time.Instant} and * @deprecated Do not use this method for new code. Instead, convert to {@link java.time.Instant}
* {@link java.time.Duration} using {@link * and {@link java.time.Duration} using {@link
* com.google.protobuf.util.JavaTimeConversions#toJavaInstant} and {@link * com.google.protobuf.util.JavaTimeConversions#toJavaInstant} and {@link
* com.google.protobuf.util.JavaTimeConversions#toJavaDuration}, do the arithmetic there, and * com.google.protobuf.util.JavaTimeConversions#toJavaDuration}, do the arithmetic there, and
* convert back using {@link com.google.protobuf.util.JavaTimeConversions#toProtoTimestamp}. * convert back using {@link com.google.protobuf.util.JavaTimeConversions#toProtoTimestamp}.
*
* <p>This method will be deprecated once most uses have been eliminated.
* <!-- MOE:end_intracomment_strip --> * <!-- MOE:end_intracomment_strip -->
*/ */
@Deprecated // MOE:strip_line
public static Timestamp subtract(Timestamp start, Duration length) { public static Timestamp subtract(Timestamp start, Duration length) {
checkValid(start); checkValid(start);
Durations.checkValid(length); Durations.checkValid(length);

Loading…
Cancel
Save