• Moarn (unregistered)

    Java autoboxing exists since Java 1.5 so in the early 2000's it was not yet possible.

    Apart from that, atrocious

  • (nodebb)

    I can imagine a lonely person boxing gifts for themselves, leaving them on the porch, then unboxing them the next day. A very lonely person, bordering on mental issues.

  • (nodebb) in reply to Mr. TA

    No, the person boxes the gifts for others they have never met, leave the gifts on the porch, and when the Amazon Delivery Thief takes it and unboxes it the next day, the thief is in for a surprise! How much damage can a booby-trap do before it is considered a criminal act?

  • akozakie (unregistered)

    While definitely a sarin-leveI code smell, I don't think this would be a performance issue with modern Java - looks easy enough to optimize away. Back then - I'm not so sure...

  • Industrial Automation Engineer (unregistered)

    This makes me want to box someone's ears.

  • Edd (unregistered)

    Was expecting the story to lead to much worse code. This isn't that bad, it doesn't crash or do something completely wrong.

  • King (unregistered)

    Invented on boxing day?

  • Prime Mover (unregistered)

    Hmm ... wonder if that's the company I worked at in the 2010's ...

  • Duston (unregistered)

    "How much damage can a booby-trap do before it is considered a criminal act?" Two words: Glitter bomb.

  • (nodebb) in reply to akozakie

    But why would you add a compiler optimization for something as inane as this? What legit scenario would something similar appear in, barring brain death?

  • my name is missing (unregistered)

    Hire people you don't know to build something you know nothing about who themselves probably know nothing about it and you expect to get... something? Sadly I experienced the aftermath of exactly this scenario and basically rewrote it all.

  • Yeah…no (unregistered) in reply to my name is missing

    Been there, done that, got the neurosis.

  • (nodebb) in reply to Nutster

    I think fireworks should be legal everywhere and if opening a box by a thief ACCIDENTALLY sets of a ginormous explosion, it would be perfectly reasonable - committing crimes is hazardous, you know.

  • Naomi (unregistered) in reply to Vilx

    It's not optimized away, partially for the reasons you gave and partially because the JLS makes certain guarantees when you call new. It was never a good idea to rely on them for boxed types (Integer and so on), but enough projects do that changing them was considered a non-starter. The boxed types' constructors have recently been marked as deprecated for removal to change that state of affairs.

    There's also work being done to further address the weirdness of boxed types (among other things).

  • Naomi (unregistered) in reply to Mr. TA

    As an aside, don't do this. You'd be on the hook for at least reckless endangerment.

    (Well, okay, if you ordered fireworks somewhere where that's legal and the thief actually managed to set them off by accident, that's a different matter. If you arrange for them to """accidentally""" set them off, well...)

  • Let's go! (unregistered)

    "Come on, guys! This company's paying us millions of bucks. Let's not simply pass a 0 as an argument - spice it up a little!"

  • (nodebb) in reply to Edd

    It just betrays a complete lack of understanding of such esoterica as checks notes primitives... and objects.

  • (nodebb)

    What's in the box?

    Pain.

  • (nodebb) in reply to my name is missing

    and you expect to get... something?

    It's fair to say that they got something. Something bad (or maybe worse than that), but definitely something.

Leave a comment on “Inside a Box”

Log In or post as a guest

Replying to comment #:

« Return to Article