JDK-8261092 : Deprecate for removal protected access members in DateTimeStringConverter
  • Type: CSR
  • Component: javafx
  • Sub-Component: base
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: jfx17
  • Submitted: 2021-02-03
  • Updated: 2023-11-23
  • Resolved: 2021-02-05
Related Reports
CSR :  
Relates :  
Description
Summary
-------

DateTimeStringConverter exposes internal implementation details by mistake. They are made deprecated for removal.

Problem
-------

DateTimeStringConverter has protected members that allow access to its internal state. These should not be part of the public API.

Solution
--------

Deprecate for removal the protected access members so that they can be removed from public API.

Specification
-------------

     .../util/converter/DateTimeStringConverter.java   | 15 +++++++++++++++
     1 file changed, 15 insertions(+)
    
    diff --git a/modules/javafx.base/src/main/java/javafx/util/converter/DateTimeStringConverter.java b/modules/javafx.base/src/main/java/javafx/util/converter/DateTimeStringConverter.java
    index 1b81bc5f9d..ae18858310 100644
    --- a/modules/javafx.base/src/main/java/javafx/util/converter/DateTimeStringConverter.java
    +++ b/modules/javafx.base/src/main/java/javafx/util/converter/DateTimeStringConverter.java
    @@ -44,20 +44,33 @@
     
         // ------------------------------------------------------ Private properties
     
    +    /**
    +     * @deprecated This field was exposed erroneously and will be removed in a future version.
    +     */
    +   @Deprecated(forRemoval = true, since = "17")
         protected final Locale locale;
    +
    +    /**
    +     * @deprecated This field was exposed erroneously and will be removed in a future version.
    +     */
    +   @Deprecated(forRemoval = true, since = "17")
         protected final String pattern;
    +
    +    /**
    +     * @deprecated This field was exposed erroneously and will be removed in a future version.
    +     */
    +   @Deprecated(forRemoval = true, since = "17")
         protected final DateFormat dateFormat;
     
         /**
    +     * @deprecated This field was exposed erroneously and will be removed in a future version.
          * @since JavaFX 8u40
          */
    +   @Deprecated(forRemoval = true, since = "17")
         protected final int dateStyle;
     
         /**
    +     * @deprecated This field was exposed erroneously and will be removed in a future version.
          * @since JavaFX 8u40
          */
    +   @Deprecated(forRemoval = true, since = "17")
    @@ -205,6 +218,8 @@ public DateTimeStringConverter(DateFormat dateFormat) {
          *
          * @return a {@code DateFormat} instance for formatting and parsing in this
          * {@link StringConverter}
    +     *
    +     * @deprecated This method exposes internal implementation details and will be removed in a future version.
          */
    +   @Deprecated(forRemoval = true, since = "17")
         protected DateFormat getDateFormat() {


Comments
Moving to Approved.
05-02-2021

Looks good.
04-02-2021

Moving to Provisional. I'll wait for [~kcr]'s review, and likely updated diff, before Approving.
04-02-2021

The `@Deprecated(forRemoval = true, since = "17")` is also part of the diffs.
04-02-2021

It took the diffs from the last commit to the one before it instead of to the first one, sorry. Fixed now.
04-02-2021

It isn't clear from the specification section which parts are new (i.e., just the @deprecated javadoc tags and the @Deprecated annotations). I think it would be easier to see that if you uploaded it as a diff. Also, you can skip the implementation of the one method. Looks good otherwise.
03-02-2021