views:

19

answers:

1

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);`
A: 

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

mart
thank you, I will check them soon
java core