RFR: 8323706: Remove SimpleSelector and CompoundSelector classes [v6]

John Hendrikx jhendrikx at openjdk.org
Wed Aug 7 01:38:55 UTC 2024


> Moves `SimpleSelector` and `CompoundSelector` to internal packages.
> 
> This can be done with only a minor API break, as `SimpleSelector` and `CompoundSelector` were public before.  However, these classes could not be constructed by 3rd parties.  The only way to access them was by doing a cast (generally they're accessed via `Selector` not by their sub types).  The reason they were public at all was because the CSS engine needs to be able to access them from internal packages.
> 
> This change fixes a mistake (or possibly something that couldn't be modelled at the time) when the CSS API was first made public. The intention was always to have a `Selector` interface/abstract class, with private implementations (`SimpleSelector` and `CompoundSelector`).
> 
> This PR as said has a small API break.  The other changes are (AFAICS) source and binary compatible:
> 
> - Made `Selector` `sealed` only permitting `SimpleSelector` and `CompoundSelector` -- as `Selector` had a package private constructor, there are no concerns with pre-existing subclasses
> - `Selector` has a few more methods that are now `protected` -- given that the class is now sealed, these modified methods are not accessible (they may still require rudimentary documentation I suppose)
> - `Selector` now has a `public` default constructor -- as the class is sealed, it is inaccessible
> - `SimpleSelector` and `CompoundSelector` have a few more `public` methods, but they're internal now, so it is irrelevant
> - `createMatch` was implemented directly in `Selector` to avoid having to expose package private fields in `Match` for use by `CompoundSelector`
> - No need anymore for the `SimpleSelectorShim`

John Hendrikx has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains eight commits:

 - Improve error message
 - Merge remote-tracking branch 'origin/master' into feature/selectors-to-private-api-standalone
 - Make match fields private by moving match creation logic
 - Move binary CSS serialization code to internal class
 - Fix review comments
 - Merge branch 'master' of https://git.openjdk.org/jfx into feature/selectors-to-private-api-standalone
 - Add since tags
 - Move SimpleSelector and CompoundSelector to private classes

-------------

Changes: https://git.openjdk.org/jfx/pull/1333/files
  Webrev: https://webrevs.openjdk.org/?repo=jfx&pr=1333&range=05
  Stats: 1830 lines in 14 files changed: 907 ins; 887 del; 36 mod
  Patch: https://git.openjdk.org/jfx/pull/1333.diff
  Fetch: git fetch https://git.openjdk.org/jfx.git pull/1333/head:pull/1333

PR: https://git.openjdk.org/jfx/pull/1333


More information about the openjfx-dev mailing list