From 4dfa3799a60cb11092b699db5bc0cc1f44d24484 Mon Sep 17 00:00:00 2001 From: Justin Lu Date: Fri, 20 Oct 2023 17:37:51 +0000 Subject: [PATCH] 7061097: [Doc] Inconsistenency between the spec and the implementation for DateFormat.Field Reviewed-by: naoto --- src/java.base/share/classes/java/text/DateFormat.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/java.base/share/classes/java/text/DateFormat.java b/src/java.base/share/classes/java/text/DateFormat.java index d5083f11965..e0d05d78a28 100644 --- a/src/java.base/share/classes/java/text/DateFormat.java +++ b/src/java.base/share/classes/java/text/DateFormat.java @@ -944,9 +944,12 @@ public abstract class DateFormat extends Format { /** * Returns the {@code Calendar} field associated with this * attribute. For example, if this represents the hours field of - * a {@code Calendar}, this would return - * {@code Calendar.HOUR}. If there is no corresponding - * {@code Calendar} constant, this will return -1. + * a {@code Calendar}, this method would return {@code Calendar.HOUR}. + * The return value of {@code -1} guarantees that this field does not + * represent any corresponding constant in {@code Calendar}. + * + * @implSpec The default implementation always returns {@code -1} if it does + * not represent any corresponding constant in {@code Calendar}. * * @return Calendar constant for this field * @see java.util.Calendar