JavacTask.parse() 的 Javac AST 符号解析
正如我几天前在官方 Java 支持论坛上发布的那样,我想知道 JCTree Symbols 是否可以使用原始 javac 实现从自己的代码中解析。
http://forums.oracle.com/forums/thread.jspa ?threadID=1774807&tstart=0
JCMethodInvocation object1 = (JCMethodInvocation) objectRef.ref;
解析resolve = 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);`
As I posted on the official Java support forum several days ago, I want to know, if JCTree Symbols can be resolved from own code with the original javac implementation.
http://forums.oracle.com/forums/thread.jspa?threadID=1774807&tstart=0
JCMethodInvocation object1 = (JCMethodInvocation) objectRef.ref;
Resolve resolve = 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);`
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我建议您研究 com.sun.tools.javac.main.JavaCompiler 如何进行符号解析。我认为它在 #enterTrees(List) 里面
你也可能对项目感兴趣 http://bitbucket.org/amelentev /juast/ 和projectlombok.org
I recommend you to investigate how com.sun.tools.javac.main.JavaCompiler do symbol resolving. I think it is inside #enterTrees(List)
Also you may be interested in projects http://bitbucket.org/amelentev/juast/ and projectlombok.org