RFR: 8257512: Remove use of deprecated primitive constructors in JavaFX [v3]

Ambarish Rapte arapte at openjdk.java.net
Thu Mar 11 19:32:10 UTC 2021


On Thu, 11 Mar 2021 15:18:51 GMT, Nir Lisker <nlisker at openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/prism/j2d/J2DPipeline.java line 64:
>> 
>>> 62:     @Override
>>> 63:     public ResourceFactory getResourceFactory(Screen screen) {
>>> 64:         Integer index = Integer.valueOf(screen.getAdapterOrdinal());
>> 
>> Autobox?
>> 
>> Same for the other similar places.
>
> Do you have a preference here?

I am little more on the side to use explicit calls when using values returned by a method. The method `screen.getAdapterOrdinal()` returns an int. But if it returned short then autoboxing will fail, but `Integer.valueOf()` would still work. I don't think the method would ever change, but I still lean on using explicit call. Being explicit safe guards more and anyway both still create an object.

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

PR: https://git.openjdk.java.net/jfx/pull/423


More information about the openjfx-dev mailing list