WARNING: This blog entry was imported from my old blog on blogs.sun.com (which used different blogging software), so formatting and links may not be correct.
Jackpot is finally available.... well, as an alpha that is. But hey, I love to live on the bleeding edge - I always run with the latest and greatest bits I can get my hands on.
Here's the announcement, sent only to the NetBeans development mailing list. At this stage, the UI is not ready, but developers can start playing with the concepts and start writing refactoring scripts. Refactoring scripts, what's that you say?
Jackpot really is a new approach to refactoring. Sure, there are builtin refactorings - code transformations that are coded as direct AST manipulation. However, Jackpot also lets you write your own Rule files, using a special but obvious
rule language. Rather than describe it here, just
go check out the tutorial.
Unfortunately, there are no screenshots in the tutorial. And for any new software, the first thing I look for are screenshots. So, below follows a few screenshots to hopefully whet your appetite. It's exciting to see so many new innovations going into the NetBeans IDE!
Here's the first thing I did. I applied the "Add Override Annotations" transform. This goes and looks for all methods that are currently overriding another, and adds the new JDK 5
@Override annotation to all these methods. I've recently started using this annotation in my code, but I've added them haphazardly, so it's nice to be able to do this in one shot. When you run the transformer, you get a results window with diffs before you apply the change:
As I mentioned, you can write your own rule files too. This is the real big deal about Jackpot. It allows you to write your own, simple source substitutions - with full accuracy on types. The below shows some code cleanup rules. There are many many other rule files too, and more deprecated uses ones should be written.
Here's the current queries menu - queries simply list results, but doesn't actually change the code:
Here's the current transforms menu:
Note that it's very easy to add to these menus. Create your own rule files, open up the Command Manager and add a reference to your rule file (what, did you think "Tor's Test Rules" at the end of the menu above was part of the Jackpot distribution?). It then shows up in the menu and you can run it. Developers can then share these rule files. If you come up with some good rules, PLEASE please share them!
P.S. Remember it's an alpha so don't start complaining if you get exceptions, if the UI isn't Right(tm), etc.