RFR: JDK-8324182 Deprecate for removal SimpleSelector and CompoundSelector classes [v2]
John Hendrikx
jhendrikx at openjdk.org
Fri Feb 2 13:30:19 UTC 2024
On Fri, 19 Jan 2024 16:00:49 GMT, John Hendrikx <jhendrikx at openjdk.org> wrote:
>> The SimpleSelector and CompoundSelector classes are public classes in an exported package, javafx.css, but they are not intended to be used by applications. They are implementation details. They cannot be constructed directly and no other JavaFX API accepts or returns a SimpleSelector or CompoundSelector.
>>
>> We should deprecate them for removal so we can move them to a non-exported package, removing them from the public API.
>
> John Hendrikx has updated the pull request incrementally with one additional commit since the last revision:
>
> Add since parameter to deprecation annotation
Okay, so I added the method `Set<String> getClasses()`:
The reasoning is as follows:
- The ideal name `getStyleClasses` is currently in use by `List<String> getStyleClasses()`
- Internally (for selectors), style classes are not a `List`, duplicates are removed, and the order is lost. Exposing it as a `List` seems to offer guarantees we can't offer
- Perhaps the next best name `getStyleClassSet` is taken up by the old `Set<StyleClass> getStyleClassSet()` -- I can't use this as `StyleClass` is about to be phased out for performance reasons
- Mirroring what `Styleable` does with `ObservableList<String> getStyleClass()` is less than ideal (it is a `List`), however it does set some precedence for using a name like `getStyleClass` even though that is not a best practice for collections (it should be plural)
- CSS reference never really uses the term "style classes", just classes: https://www.w3schools.com/cssref/css_selectors.php
My conclusion is that we either need two rounds to get this right (to first free up our first choice `getStyleClasses`), or we can settle on one of: `getStyleClassNames`, `getStyles`, `getStyleNames`, `getClasses`, `getClassNames`.
-------------
PR Comment: https://git.openjdk.org/jfx/pull/1340#issuecomment-1923809524
More information about the openjfx-dev
mailing list