Great Refactoring Support For OSS Projects
I've recently crossed a product called
Refactor IT. They offer
unlimited free usage on open source projects. There is a
plug-in available for NetBeans.
Why am I blogging about it? Although many refactorings are
being prepared for 4.2, people using 4.1 have only several refactorings in their disposal. Refactor IT might be a good solution if you are working on an OSS project or your employer is willing to buy the plug-in.
Screenshot of available refactorings + graph of dependencies:
Scripting Support in Mustang - An Example You Can Try
Well, it's 1:30 a.m. but feels like late afternoon. Time shift is a funny thing. I thought that if I can't sleep, I could try to play with the new scripting support in Mustang (JSR-223). Well, it's as simple as this:
Preparing JavaScript code (notice I am using java.lang.StringBuffer inside JavaScript - isn't that cool?):
input.setText("var out = new java.lang.StringBuffer();\nfor (i=0; i<3; i++)\n
out.append('hello, world! ('+i+')\\n');");
Executing the code:
ScriptEngineManager manager = new ScriptEngineManager();
ScriptEngine jsengine = manager.getEngineByName("js");
try {
jsengine.eval(input.getText());
String out = new String((StringBuffer)jsengine.get("out"));
output.setText(out);
} catch (javax.script.ScriptException e) {
output.setText("ScriptException" + e);
}
A screenshot:
Full source code is
here. To execute, you need to install
latest mustang build.
Well, if it's simple as this it may mean future Java code getting "polluted" by scripting code. Programming in scripting languages can be very productive for certain types of problems. Currently, Rhino JavaScript support is available by Sun as reference implementation and PHP support is being written, too. Any other languages may follow - the scripting framework enables any other languages to be plugged in. I really wonder what will be the impact of JSR 223 on web development...