2010-10-29 47 views
1

前幾天我在官方的Java支持論壇發佈了,我想知道,如果JCTree符號可以從原始的javac實現自己的代碼解決。Javac AST符號解析爲JavacTask.parse()

http://forums.oracle.com/forums/thread.jspa?threadID=1774807&tstart=0

JCMethodInvocation object1 = (JCMethodInvocation) objectRef.ref; 

解決決心= Resolve.instance(javacTaskImpl.getContext());

ListBuffer<Type> argtypeListBuffer = new ListBuffer<Type>(); 
AttrContext attrContext = new AttrContext(); 
Env<AttrContext> env = new Env<AttrContext>((JCTree) objectRef.ref, attrContext); 

System.out.println(type); 
System.out.println(type.tsym); 

resolve.resolveInternalMethod(object1.pos(), env, type, name, argtypeListBuffer.toList(), null);` 

回答

0

我建議您調查com.sun.tools.javac.main.JavaCompiler如何執行符號解析。我認爲這是內部#enterTrees(名單)

而且您可能感興趣的項目http://bitbucket.org/amelentev/juast/和projectlombok.org

+0

謝謝你,我會很快檢查他們 – 2010-10-31 03:12:14