ok2c commented on a change in pull request #330:
URL:
https://github.com/apache/httpcomponents-client/pull/330#discussion_r757802391
##########
File path:
httpclient5/src/main/java/org/apache/hc/client5/http/cookie/Cookie.java
##########
@@ -77,9 +78,26 @@
* considered immutable. Changing it (e.g. using setTime()) could result
* in undefined behaviour. Do so at your peril. </p>
* @return Expiration {@link Date}, or {@code null}.
+ * @deprecated Use {{@link #getExpiryInstant()}}
*/
+ @SuppressWarnings("DeprecatedIsStillUsed")
+ @Deprecated
Date getExpiryDate();
+ /**
+ * Returns the expiration {@link Instant} of the cookie, or {@code null}
if none exists.
+ * <p><strong>Note:</strong> the object returned by this method is
+ * considered immutable. Changing it (e.g. using setTime()) could result
in undefined behaviour.
+ * Do so at your peril. </p>
+ *
+ * @return Expiration {@link Instant}, or {@code null}.
+ * @since 5.2
+ */
+ default Instant getExpiryInstant() {
+ final Date date = getExpiryDate();
Review comment:
@arturobernalg This is where you should be suppressing deprecation
warnings.
##########
File path:
httpclient5/src/main/java/org/apache/hc/client5/http/cookie/Cookie.java
##########
@@ -77,9 +78,26 @@
* considered immutable. Changing it (e.g. using setTime()) could result
* in undefined behaviour. Do so at your peril. </p>
* @return Expiration {@link Date}, or {@code null}.
+ * @deprecated Use {{@link #getExpiryInstant()}}
*/
+ @SuppressWarnings("DeprecatedIsStillUsed")
+ @Deprecated
Date getExpiryDate();
Review comment:
@arturobernalg This looks wrong. Why are you suppressing deprecated
method itself and not its usage where required for backward compatibility?
Please correct it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]