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

Update constant collections to use the new immutable collections



    • Enhancement
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • jfx11, 9, 10
    • jfx15
    • javafx


      JavaFX contains many collections which are supposed to be immutable. With the addition of the built-in immutable collections in Java 9, we should update the current collections to these.

      The advantages are better readability, possibly better performance, and finding bugs due to invalid entries (1 case was found).

      All of the identifiers for this collections will be renamed to constant style (uppercase with underscores) to signify that the collection is immutable (though not necessarily the items it contains). For maps, the keys and values will be visually aligned for readability.

      A list of all affected places will be maintained here:

      --- MAP ---

      1. javafx.scene.control.skin.ColorPickerSkin: colorNameMap and cssNameMap

      2. com.sun.javafx.fxml.builder.ProxyBuilder: defaultsMap - double 'int.class' entry found and removed. Since it contains a null value it can't be converted to immutable.

      3. javafx.scene.web.WebView: idMap

      4. com.sun.javafx.webkit.KeyCodeMap: MAP

      5. com.sun.javafx.iio.ios.IosImageLoader: colorSpaceMapping - there seems to be an initialization order intricacy here.

      6. com.sun.scenario.effect.compiler.backend.hw.ES2Backend/GLSLBackend/HLSLBackend: qualMap, varMap, funcMap, typeMap

      7. javafx.scene.paint.Color: namedColors

      8. com.sun.webkit.network.DateParser: MONTH_MAP

      9. com.sun.webkit.network.URLs: handlerMap

      10. com.sun.webkit.text.TextCodec: reMap

      11. com.sun.prism.j2d.print.J2DPrinter: preDefinedTrayMap and predefinedPaperMap.

      --- SET ---

      1. com.sun.scenario.effect.impl.prism.PrRenderer: intrinsicPeerNames

      --- LIST ---

      1. javafx.scene.Node: STYLEABLES. Need to think about the subclasses' use - they copy the list and add to it, which is not suitable for an immutable list.

      2. com.sun.glass.ui.mac.MacAccessible: baseAttributes, textAttributes, textParameterizedAttributes

      3. com.sun.javafx.scene.input.InputEventUtils: TM_ANY and TM_COPY_OR_MOVE, and in the method safeTransferModes.

      4. com.sun.prism.impl.PrismSettings: tryOrder (didn't change identifier style so it fits with the rest of the constants in the class)

      5. javafx.scene.paint.Stop: NO_STOPS


        Issue Links



              nlisker Nir Lisker
              nlisker Nir Lisker
              0 Vote for this issue
              2 Start watching this issue