RFR: 8346227: Seal Paint and Material [v2]

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


On Tue, 17 Dec 2024 18:13:28 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> 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?
>
> `null` is not a valid argument for this method, and has never been. `acc_getPlatformPaint()` previously asserted that the return value is not `null`.

this is not what I am asking though: in more than one place we have _callers_ like this

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


it could be changed to 

peer.setFillPaint(tk.getPaint(getFill()));

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

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


More information about the openjfx-dev mailing list