Java 1.5

Posted on Apr 11, 2004


Due to my involvement with the DrJava project at Rice, I’ve used JSR-14 since the very early betas. My own view of generics is that they are an excellent tool to be familiar with. I’m not equipped to comment on whether they’re inferior to generics in language X– I don’t know language X.

The best parts of generics we’ll only come to realize after our best programmers get their minds on it. Even though all Generics really offer is shortcuts in terms of what you type in your source code, it’s a high-order idea which I can use in my own programming. For example, the goal of writing a simple interface to map a “function” using the Command pattern over a Collection and have it return the “right” object type. This is probably the language construct I miss most from Scheme.

I saw one unbelievably cool example of generic code for exception handling, but I don’t remember anything about it.

My point is that I’m glad Java has it. If you don’t like it, obviously you don’t have to use it.


I understand what’s going on here, but I haven’t needed anything like it yet. Of course, I haven’t made a very complex Domain Model yet.


Sure, why not? Will I even use it, though? Probably not. I’ll definitely be using generics at some point, so why not take what feels like a lazy shortcut? I guess I’ll just re-evaluate my feelings then.


This is another example of just shortcuts in typing, as this functionality was always available with inner classes. It just makes it nicer to type. We’ll see if Hibernate ties up their PersistentEnum into this construct so that I can take advantage of it without writing special methods that only make sense when used with Hibernate.

Enhanced For loops

Once again, just a shortcut. I have changed the way I write loop code on my currect project to change easily when it comes time.


I’m going to have to attend my No Fluff, Just Stuff conference in Reston next month to comment on this.

Static Import

Now this I like! I have a lot of terms defined as constants in classes, and static import lets me access them without so much typing.

So, to sum up, all these constructs really just save you typing. Of course, there’s new things in the library, and modfications to the VM that I’m sure will help everyone. But I say, bring it on. I will not begin using the new features until it gets out of beta, but the 1.5 beta is already running Tomcat and the web application that I’ve been writing for the past few months in deployment.