给定 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 比较 API (org.eclipse.compare) 找到 AST 差异?(这可以在插件之外完成吗?)
我正在查看以下 API
http://kickjava.com/src/org/eclipse/compare/structuremergeviewer/Differencer.java.htm http://kickjava.com/src/org/eclipse/jdt/internal/ui/compare/JavaStructureCreator.java.htm http://kickjava.com/src/org/eclipse/compare/CompareUI.java.htm
任何人都可以指向示例代码(或 API - 但首选代码)。