views:

363

answers:

1

Could you provide an example of accessing the Eclipse Abstract Syntax Tree programmatically for a given piece of code?

eg getting the AST for:


Class1.java

package parseable;

public class Class1 {

/**
 * @param args
 */
public static void main(String[] args) {
 System.out.println("Hello world!");
}

}

+2  A: 

It is not an exact answer, that may give you a place where to start:

As said in this question,

A full example is available in this eclipse corner article, also more details in the eclipse help. And in the slide 59 of this presentation, you see how to apply a change to your source code.

VonC