Skip to main content

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

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.


Back to the top