How do I acquire AST of an .aj source file?https://www.eclipse.org/forums/index.php/mv/msg/21001/67311/#msg_67311
Originally posted by: Rafal.Krzewski.caltha.pl

Hello,

I have a question about AJDT (or perhaps AJDE) API usage. I need to get
a use it to collect information about binary that get compiled from a
source file, and also source information for a binary type sufficient to
open the relevant source in an editor.

I was trying to do the same for AspectJ sources but without success. My
first guess was flipping the imports from org.eclipse.ajdt to
org.aspectj.org.eclipse.ajdt but it didn't work - I got a
ClassDefNotFound error without detail message inside JavaCore.create(..)
call, presumably during JavaModelManager.<clinit>. Weird, isn't it?

But it's no good because the bindings don't get resolved. According to
my limited knowledge of JDT it is probably because
parser.setSource(ICompilationUnit) nor parser.setProject(IJavaProject)
were not called. I couldn't to that since AJCompilationUnit implements
ICompilationUnit from org.eclipse.jdt.core and not from
org.aspectj.org.eclipse.jdt.core

I'll be happy to do my own source digging, but please show me the
direction :)

Thanks in advance,
Rafał]]>2006-10-18T22:08:59-00:00Re: How do I acquire AST of an .aj source file?https://www.eclipse.org/forums/index.php/mv/msg/21001/595101/#msg_595101
Originally posted by: hawkinsh.uk.ibm.com

The AjASTVisitor and ASTParser are in the
org.aspectj.org.eclipse.jdt.core.dom package. Also note that the AST that
is returned from cu.getAST() is an AjAST (which is also in the
org.aspectj.org.eclipse.jdt.core.dom package).

PS. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=119017 for info
about org.aspectj.org.eclipse.jdt.core.JavaCore.create(..)]]>2006-10-19T08:10:36-00:00Re: How do I acquire AST of an .aj source file?https://www.eclipse.org/forums/index.php/mv/msg/21001/67324/#msg_67324
Originally posted by: hawkinsh.uk.ibm.com

The AjASTVisitor and ASTParser are in the
org.aspectj.org.eclipse.jdt.core.dom package. Also note that the AST that
is returned from cu.getAST() is an AjAST (which is also in the
org.aspectj.org.eclipse.jdt.core.dom package).

PS. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=119017 for info
about org.aspectj.org.eclipse.jdt.core.JavaCore.create(..)]]>2006-10-19T08:10:36-00:00Re: How do I acquire AST of an .aj source file?https://www.eclipse.org/forums/index.php/mv/msg/21001/67339/#msg_67339
Originally posted by: Rafal.Krzewski.caltha.pl

There's a compilation error on the last included statement -
ICompilationUnit type of source variable is from JDT, but
ICompilationUnit argument of setSource method is from AJDE compiler shadow.

The examples in the bugs you mentioned use
parser.setCompilerOptions(new HashMap());
parser.setSource(source.getSource().toCharArray());
And with this kind of setup the bindings are not getting resolved.

Is there any other approach on the task of determining .aj <-> .class
relationships within an AJDT enabled project that I could try?

thanks,
Rafal]]>2006-10-19T22:08:29-00:00Re: How do I acquire AST of an .aj source file?https://www.eclipse.org/forums/index.php/mv/msg/21001/595108/#msg_595108
Originally posted by: Rafal.Krzewski.caltha.pl

There's a compilation error on the last included statement -
ICompilationUnit type of source variable is from JDT, but
ICompilationUnit argument of setSource method is from AJDE compiler shadow.

The examples in the bugs you mentioned use
parser.setCompilerOptions(new HashMap());
parser.setSource(source.getSource().toCharArray());
And with this kind of setup the bindings are not getting resolved.