Against 1.5 imports..

May 14th, 2003 by Hen

I’d like to join with Java guff and stuff in asking if _anyone_ out there is in favour of the damned new import syntax for JDK 1.5?!?

4 Responses to “Against 1.5 imports..”

  1. Fred Grott Says:

    Sorry for being in the dark what are the changes between import syntax for jdk1.4 and jdk1.5?

  2. Mats Henricson Says:

    I think they’re terrible too:

    http://www.freeroller.net/page/matsh/20030313

  3. Joe Says:

    Put simply, you can now import a static method or inner class (i think) directly, instead of having to import the parent class and reference it through the parent class’s namespace.

    E.g., instead of

    x = Math.sqrt(5);

    you can do

    import java.lang.Math.sqrt;

    x = sqrt(5);

    personally, I think its rediculous too, just to save a few bits of typing (when http://acroyear.blog-city.com/readblog.cfm?BID=17516 shows that there’s plenty of other changes over time that multiply the amount of typing by factors of 5). It also floods the namespace and puts more work on code mainainers to trying to figure out where something comes from when trying to read it. Now the maintainer has to look in multiple places to determine if a called function came from a parent class or from some import line, and the compiler also has to try to make that distinction should an imported method and an inherited method carry the same name. To avoid conflicts, its best to just not bother to use the new syntax at all. I certainly won’t.

  4. Dave Says:

    Yeah, I think it’s pretty lame. It can lead to some pretty unreadable code, and I don’t see the benefit. I mean, in any reasonable code editor (including vim!!), you just type the first few letters of the classname and then complete it. Stuff to save typing at the expense of readability is not very justifiable.

    What they really should’ve done is allow subclasses to inherit constructors and allow you to call this() and super() anywhere in a constructor. I’m tired of making init() methods.