I had the pleasure of showing up to see Ted Neward give a presentation at the Silicon Valley Java Users Group. The presentation was all about JSR 175: Custom annotations and metadata. Ted is a member of the expert group, and was joined by a familiar face in the crowd, Joshua Bloch, the Sun spec lead was there to lend a hand.
Ted started with a history on "how we got here", where he discussed how Serialization was put into Java and more. Then we got to the details of JSR 175, and Ted's favorite IDE came out: Notepad. Or, I guess I could use the name that he used: Visual Notepad. He whipped up code examples and used the b32 alpha build of Tiger to prove his point.
It was really fun to watch Ted and Josh have fun with the crowd. People asked good questions such as: "So, if I have an annotation, do I *have* to include its compiled class for a program to run?". Apparently this was hotly discussed in the expert group, and rightly so. If you are an IDE vendor, you may want to put together a group of annotations, and don't want to require users to deploy those jars in their production systems. Josh explained how a group of language gurus got together for a couple of weeks, and concluded that there wasn't a nice way to have this work. Ted remarked, "What if you misspelt an annotation? Would you want the system to move on, since the class file wasn't found?".
The expert group really held out on creating "standard" annotations. The mandate for this group was to come up with the mechanism. Other JSRs will come out with standard annotations, and more. There is ONE exception though. You can mark a method with @Override, and if your method doesn't actually override a method in a parent class, you will get an error (not a warning). This will stop ugly bugs like implementing equals(MyClass c) when you meant to implement equals(Object o).
There were obviously a lot of hard decisions to make with this JSR. After hearing Josh speak on some of the issues, I am pretty excited about how it has all turned out. It will take a long time to see how much this affects our world, won't it. You know
that people are going to miss use putting attributes on their classes (remember, use attributes that say something like "this method is long running", compared to "start a new thread for me").
Let's bring it on.
JSR 175: A Metadata Facility for the Java Programming Language
TSS Discussion: Metadata Public Review Gets Some Feedback
p.s. The trip to the JUG was made worthwhile as I got to watch Ted on his knees. His car tire bust, so on came the spare. Jay Zimmerman (of the No Fluff Just Stuff Symposiums) and I enjoyed watching him sweat!