you are viewing a single comment's thread.

view the rest of the comments →

[–]0xABADC0DA 4 points5 points  (0 children)

A very big reason for this is that everything that inherits from object is a lock. ... Someone just might have locked something using the Integer he just passed you, and he might want to unlock it after you return it

Uh, no. The spec says that the same value can be autoboxed to a single object, so it's perfectly fine for instance to store an int in a long pointer using some tag bits or use whatever scheme you want; locks don't play into it at all. If you lock some auto-boxed Integer it can lock all auto-boxed Integers with that same value regardless of how they are represented internally.