You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1.getClass returns the int primitive class, but actually does some boxing when looking at the bytecode. I'm not sure why this would be necessary.
1.asInstanceOf[Int with Tag].getClass returns the boxed java.lang.Integer class, even though removing the .getClass returns a primitive int value.
Because of this magic boxing performed in the bytecode, it makes it hard to inspect things at runtime to figure out if we're really dealing with a primitive or boxed value (particularly needed in test suites). Maybe there's a better way to get around that (welcoming suggestions), however, the superfluous boxing seems like something that should be removed.
The text was updated successfully, but these errors were encountered:
Maybe I'm missing something, but it seems invoking
getClass
does unnecessary boxing when applied to AnyVal values.https://gist.github.com/carymrobbins/ec94e043e1fb1ce20501f1808672b9f9
To summarize -
1.getClass
returns theint
primitive class, but actually does some boxing when looking at the bytecode. I'm not sure why this would be necessary.1.asInstanceOf[Int with Tag].getClass
returns the boxedjava.lang.Integer
class, even though removing the.getClass
returns a primitiveint
value.Because of this magic boxing performed in the bytecode, it makes it hard to inspect things at runtime to figure out if we're really dealing with a primitive or boxed value (particularly needed in test suites). Maybe there's a better way to get around that (welcoming suggestions), however, the superfluous boxing seems like something that should be removed.
The text was updated successfully, but these errors were encountered: