It seems that
autoboxing is evil because you can get a null pointer - and your IDE doesn't even warn you of the horrific danger. That's right, check out this scandalous code:
int sucker = thisMethodReallyReturnsAnIntegerNotAnInt();
I tried it out myself, and David is right: "No squiggly red line in your Eclipse editor". And you really get NullPointerException when you return a null. Oh my!
Shocked by the horror of it, I set off in search of similar dangers. And, my dear Java friends, you aren't going to believe what I've uncovered. Check out this fiendish piece of code.
I know what you are thinking. "I've written code like that before." So have I, and I thought I was completely safe. My IDE certainly didn't give me a red squiggly line. Normally this code works like a charm, at least for the first hour or so. But if it returns null - watch out! Boom! NullPointerException!
I've seen developers spending hours and hours in their debugger trying to track things like this down. You might even have to look at a stack trace to figure it out - it's that bad! So please, please be careful friends. The world of Java is a dangerous, dangerous place!