I'm not the Only One Singing about Software
Check
this out. Richard Stallman himself! More
here.
What Can Project Jackpot Bring to NetBeans?
Tom Ball is currently in Prague and today he had a session about
Project Jackpot. You may have heard about this technology, Tom presented it on Java One. I thought I would share some of the interesting things I've learned today.
Jackpot can be used to analyze source code and search for patterns. Then, it can transform the source code to get improvements. A typical usage is to search for some ugly code constructions and replace them by something nicer. So it serves for a kind of code analysis combined with code refactoring.
Now what's really cool is that you can specify patterns you want to find/replace. So you can for instance write a pattern which will search for all unnecessary casts and removes them. The first question you'll have is: "but how safe is it?". Jackpot creates a fully attributed AST tree from the sources, so it will never produce something uncompilable. The changes it does are very local. There are other things which help protect the code including a fully customizable pretty printer used not to break the formatting.
Here's a simple example, let's have a piece of code like this:
String message = "";
message = ex.toString();
return message;
Obviously, you can get the same functionality if you do:
return ex.toString();
You can use Jackpot to detect such patterns and to make such corrections. So you can improve the readability of the code, performance and get rid of some ugly constructions (another example - transforming difficult boolean expressions into simple ones).
The good news is that this technology will be in future integrated into NetBeans. Obviously, it's something nontrivial, we will have to come up with a good library of rules... and we'll definitely meet many obstacles. But once it's there, I can imagine many possibilities how to leverage it. The nice thing about opensource is that you never know what can come, NetBeans community may find a usage of such technology Tom has never thought of.
There used to be a time when people were saying about NetBeans that we are not very innovative. If I take a look today at Matisse, J2ME features (the visual designer rocks), EJB 3.0, Profiler,... now Jackpot... well, it feels good for a change. And more will come (there are some long-term features I'm not allowed to blog about).
P.S. Just noticed that basic Struts support was commited to trunk. But haven't tried it yet. The build gods are not with us lately. We'll have to pray more.
P.P.S. The build gods have heard our prayers because I've just received an e-mail with link to the build of new q-build candidate.
Update: Here's an explanation of my comment "long-term features I'm not allowed to blog about" - I am not allowed to blog about some features Sun is considering to opensource as contributions to netbeans.org. I cannot publish the details about them until it happens.