在
Eclipse中给出以下代码:
import org.eclipse.jdt.core.dom.AST;
import org.eclipse.jdt.core.dom.ASTParser;
import org.eclipse.jdt.core.dom.CompilationUnit;
public class Question {
public static void main(String[] args) {
String source = "class Bob {}";
ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setSource(source.toCharArray());
CompilationUnit result = (CompilationUnit) parser.createAST(null);
String source2 = "class Bob {public void MyMethod(){}}";
ASTParser parser2 = ASTParser.newParser(AST.JLS3);
parser2.setSource(source2.toCharArray());
CompilationUnit result2 = (CompilationUnit) parser2.createAST(null);
}
}
您如何使用Eclipse Compare API(org.eclipse.compare)来查找AST差异? (这可以在插件之外完成吗?)
我正在查看以下API
任何人都可以指向示例代码(或API – 但代码是首选).