Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what is best java libraries to write custom refactoring scripts? [closed]

I plan to do complex refactoring of large project, default ide capabilities is not enough. Please also provide tutorial link if possible.

Language: java, xml

I talk about programmatic api for java refactoring

Example I have created new api in project and I want automatically refractor some code to use it, ie source to source transformation of ast tree

like image 646
yura Avatar asked Sep 03 '11 14:09

yura


People also ask

Does Eclipse support refactoring?

In particular, EMF Refactor supports metrics reporting, smell detection, and refactoring for models being based on the Eclipse Modeling Framework, a widely used open source technology in model-based software development.


1 Answers

There's always Eclipse; you should be able to access its Java refactoring machinery via its internal procedural APIs. Whether those are easily found or well documented, I don't know. No source-to-source transformations.

There is a tool called Jackpot that was supposedly designed to support this task. I believe it also only offers procedural APIs but I think they are intentionally well documented. No source-to-source transformation capability.

Our DMS Software Reengineering Toolkit with its Java Front End could be used for this.

DMS was designed to be general purpose program transformation engine for many languages (Java is just one it happens to know about). It can carry out arbitrary code changes. DMS provides parsing to ASTs, symbol table construction, an AST manipulation interface, including OP's request for pattern-directed source-to-source transformations, and regeneration of source text (including the original comments if unchanged) from any modified AST. DMS is happy to read all the files that make up your application, so you can effect changes that cross source file boundaries easily.

People may suggest using some parser generator. While parsing is necessary, it is hardly sufficient; a parser fails to do all the other things (above) that you need.

like image 129
Ira Baxter Avatar answered Sep 20 '22 16:09

Ira Baxter