views:

326

answers:

3

Do you know an API to programmatically refactor Java code.

Preferably:

  • easy to use
  • support for rich refactorings
+4  A: 

Jackpot API is quite complete for that kind of operation.

VonC
+2  A: 

This only applies if you are working on a plugin obviously but both Eclipse (JDT) and NetBeans have public APIs which support refactoring.

willcodejavaforfood
A: 

See the DMS Software Reengineering Toolkit. It can parse Java to ASTs, provides a complete AST manipulation interface, as well as access to symbol tables. You can also apply source-to-source transformations (e.g, coded using Java fragments) to manipulate the code.

Ira Baxter