On Thu, 11 Mar 2021 07:34:29 GMT, Ambarish Rapte <ara...@openjdk.org> wrote:

>> modules/javafx.graphics/src/main/java/com/sun/prism/es2/X11GLFactory.java 
>> line 171:
>> 
>>> 169:         deviceDetails.put("XVisualID", 
>>> Long.valueOf(nGetVisualID(nativeCtxInfo)));
>>> 170:         deviceDetails.put("XDisplay", 
>>> Long.valueOf(nGetDisplay(nativeCtxInfo)));
>>> 171:         deviceDetails.put("XScreenID", 
>>> Integer.valueOf(nGetDefaultScreen(nativeCtxInfo)));
>> 
>> Autobox?
>
> I think the statements look more readable the way they are.
> The type of LHS of the expression is Object, so a reader will have to find 
> return type of those methods to understand what type of Object gets created. 
> I think such calls which use a return value from a method should use explicit 
> calls. 
> But then on other side in case if return type of the method is changed, then 
> we need to also change these explicit calls.
> Sounds like a decision to make for other time. What do you think  ?

The real problem here is not finding out what the return type is, it's that the 
`deviceDetails` type is a raw `HashMap` so it's not clear what type should be 
put in the map. If it were `HashMap<Object, Object>` then the reader should not 
care what gets put into the map since it's an `Object`.

It's fine as is anyway.

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

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

Reply via email to