Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ajdt-dev] Problems in resolving super aspect

It's hard to tell what your code is doing.  If you send me a zip of a
sample project, I can run it and see if I can figure out what's going
on.

Just eyeballing the code, here are some comments:
1. Perhaps resolve bindings isn't working during the parse and that is
why you are not able to find it in the AnotherASTVisitor class.
2. It looks like your visitTypeDeclaration method is looking at the
name of the aspect (not its super aspect).  Even so, if bindings
haven't been resolved, then you will not be able to find the qualified
type for the super aspect.
3. If all else fails, then you can search for the super aspect
yourself.  You'd need to search all the import statements.  If you
don't find any reference to the aspect there, then it may be in the
same package (or it may be an error).

hope this helps,
--andrew

On Thu, May 29, 2008 at 4:06 PM, myskin83@xxxxxxxxx <myskin83@xxxxxxxxx> wrote:
> Hi everybody,
> I'm using ajdt 1.5.0 on eclipse 3.3.2 to get structural
> information on aspectj projects. I managed to get the fully qualified name of
> the(eventually present) superclass of an aspect with this code snippet
>
>
>                         IType currentAspect=aspectsIterator.next();
>                        String
> superClassName= currentAspect.getSuperclassName();
>                        if(superClassName!=null){
>
>                                System.out.println("Superclassname for aspect "+ currentAspect.
> getFullyQualifiedName() +" is  "+superClassName);
>                                String[][]
> resolvedName=currentAspect.resolveType(superClassName,AJCompilationUnitManager.
> defaultAJWorkingCopyOwner());
>                                if(resolvedName==null){
>
>                                         //Didn't manage to auto-resolve- let's
> visit the AST
>                                        ASTParser parser = ASTParser.newParser(AST.JLS3);
>
>        parser.setCompilerOptions(new HashMap());
>                                        parser.setKind(ASTParser.
> K_COMPILATION_UNIT);
>                                        parser.setSource(currentAspect.getCompilationUnit().
> getSource().toCharArray());
>                                        parser.setResolveBindings(true);
>                                        ASTNode
> node=parser.createAST(null);
>                                        node.accept(new AnotherASTVisitor
> (currentAspect));
>                                }
>                                String fqName=resolvedName[0][0]+"."+resolvedName[0]
> [1];
>
>
> rivate final class AnotherASTVisitor extends ASTVisitor {
>                IType
> aspect;
>                public AnotherASTVisitor(IType elem){
>                        this.aspect=elem;
>                }
>
>
>
>        public boolean visit(TypeDeclaration td){
>                        //here the code manages to get
> only simple name...
>                }
>        }
>
> However, this code is not capable to extract
> the fully qualified name of the  (eventually present) abstract "super aspect"-
> the aspect that is extended by this aspect. It is able to get only the simple
> name. Some help would be much appreciated:) Hear you soon.
> _______________________________________________
> ajdt-dev mailing list
> ajdt-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/ajdt-dev
>


Back to the top