Against 1.5 imports..
May 14th, 2003 by HenI’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?!?
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?!?
May 15th, 2003 at 12:50 am
Sorry for being in the dark what are the changes between import syntax for jdk1.4 and jdk1.5?
May 15th, 2003 at 12:51 am
I think they’re terrible too:
http://www.freeroller.net/page/matsh/20030313
May 15th, 2003 at 1:08 am
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.
May 15th, 2003 at 2:13 am
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.