On Thu, 11 Mar 2021 05:47:31 GMT, Ambarish Rapte <ara...@openjdk.org> wrote:

>> modules/javafx.web/src/ios/java/javafx/scene/web/JSONDecoder.java line 101:
>> 
>>> 99:             long val = Long.parseLong(sNum);
>>> 100:             if ((val <= Integer.MAX_VALUE) && (Integer.MIN_VALUE <= 
>>> val)) {
>>> 101:                 return Integer.valueOf(int) val);
>> 
>> Autobox?
>
> I think, when LHS is of type `Object`, it is good to be explicit on creating 
> Object, it improves readability.
> In this case, type of val is `long`, so autobox would create an object of 
> `Long` not `Integer`.

RIght, this can lead to bugs if you aren't careful. See the discussion in 
[JDK-8154213](https://bugs.openjdk.java.net/browse/JDK-8154213). I recommend 
autoboxing only for those cases where the type is clearly specified.

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

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

Reply via email to