RFR: 8346227: Seal Paint and Material [v2]

Andy Goryachev angorya at openjdk.org
Tue Dec 17 18:10:45 UTC 2024


On Sat, 14 Dec 2024 17:16:20 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> The `Paint` and `Material` classes can't be extended by user code, because their implementations require special support in internal JavaFX code. The classes should be sealed.
>
> Michael Strauß has updated the pull request incrementally with one additional commit since the last revision:
> 
>   use exhaustive switch pattern

modules/javafx.graphics/src/main/java/com/sun/javafx/tk/Toolkit.java line 597:

> 595: 
> 596:     public Object getPaint(Paint paint) {
> 597:         return switch (paint) {

standard warning: not equivalent change (in the case of null `paint`).
it's ok in this case, since it looks like this method is never called with a null argument thanks to guards like this replicated across the code base:


peer.setFillPaint(getFill() == null ? null : tk.getPaint(getFill()));


would it have been easier to allow null argument and return null from `getPaint()` instead?

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1665#discussion_r1888982459


More information about the openjfx-dev mailing list