The Source for Java Technology Collaboration
User: Password:



John D. Mitchell's Blog

JaveOne 2007, Java Puzzlers Points Out Problems with Kitchen Sink

Posted by johnm on May 09, 2007 at 10:14 AM | Comments (5)

Josh Bloch and Neal Gafter have been doing their wonderful Java Puzzlers shtick at JavaOne for the last 4 years. This year, Bill Pugh has stepped in for Neal to keep the puzzlers puzzling.

The puzzles point out all sorts of interesting and exasperating gotchas in the Java language and libraries that linger for ages waiting to humble us all.

This year's set of puzzles include a slew of problems that come as a direct result of the addition of auto-boxing/-unboxing of primitives to/from their object wrapper types (int and Integer, for example). Maybe it's just me but I seem to recall a lot of us who said how bad the consequences would be of adding auto-boxing to Java and yet here they are causing exactly the worst kinds of insidiously non-obvious problems.

The moral of these puzzles isn't merely "be careful of using wrapper types with the ternary operator", but that auto-boxing is evil and should have never been added to the language in the first place.

Of course, it goes without saying that this is just one example of how new "features" added to a mature language are very dangerous. One of the big, currently brewing brouhahas is over the proposed addition of closures to Java. Perhaps folks might want to pause their rampant fervor for a bit and actually look at the history of these attempts and realize just how costly these changes really are. Especially when there are plenty of alternatives like using other languages which have their pet features which target the underlying JVM.

As Josh so eloquently put, "APIs, like diamonds, are forever."


Bookmark blog post: del.icio.us del.icio.us Digg Digg DZone DZone Furl Furl Reddit Reddit
Comments
Comments are listed in date ascending order (oldest first) | Post Comment

  • Amen!

    Posted by: detorres on May 10, 2007 at 03:50 PM

  • well said. But I fear you're preaching to the quire here, the kids who are screaming for function pointers, operator overloading, and everything else they ever heard of some other language having (and THUS it is good for Java and Java is dead without it all) aren't reading you anyway.

    Posted by: jwenting on May 10, 2007 at 09:56 PM

  • And there is no way to find out, except by careful inspection, where auto(un)boxing is being used in the code. I wish there was a lint flag to report them.

    Posted by: hemalpandya on May 11, 2007 at 02:18 AM

  • yah. Fixed some autounboxing related NPEs this week.
    Spurious little buggers.

    Posted by: jwenting on May 11, 2007 at 04:14 AM

  • I'm so grateful for all that you've done. Thanks again for that nice essay and I would be most grateful if you would send me the latter ones....


    mirc
    mırc
    mirç
    mırç
    mirc indir
    chat yap
    islami sohbet
    dini sohbet
    kelebek
    kelebek sohbet
    kelebek mirc
    kameralı mirc
    kameralı sohbet
    chat yap
    çet
    çet odaları
    sohbet kanalları
    sohbet odaları
    yarışma
    sevgili
    arkadaş
    arkadaş ara
    arkadaşlık

    Posted by: jklmno on June 19, 2008 at 09:13 AM



Only logged in users may post comments. Login Here.


Powered by
Movable Type 3.01D
 Feed java.net RSS Feeds