Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8304959

Public API in javafx.css.Match should not return private API class PseudoClassState

    XMLWordPrintable

Details

    Description

      The class Match is public and is part of javafx.css, and exposes a method `getPseudoClasses`. This returns `PseudoClassState`, which is IMHO incorrect as this is not public API.

      Instead, it should do what all other methods part of the public API do when returning the `PseudoClass`-es and return `Set<PseudoClass>`:

      For example, SimpleSelector has the same method, but returns `Set<PseudoClass>`, and `Styleable` returns `ObservableSet<PsuedoClass>`.

      Matches can't be constructed directly, but are returned from Selectors.

      Motivation to fix this:

      I've been looking into memory consumption of JavaFX, and PseudoClassState tops RectBounds by a factor of 2 in my heavily styled application. Most of these are not ever modified as they're part of stylesheets, and most of these are duplicates. There were 27000 instances vs 1200 Nodes.

      I think these can be made immutable and reused when used as part of a stylesheet, but the above problem is blocking this as it exposes `PseudoClassState` directly, which is mutable.


      Attachments

        Issue Links

          Activity

            People

              jhendrikx John Hendrikx
              jhendrikx John Hendrikx
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: