Community
Participate
Working Groups
I'm assuming this means extending the AspectJ ASTVisitor class with visit methods for things like PointcutDeclaration etc (with appropriate definitions of PointcutDeclaration etc in the org.aspectj.org.eclipse.jdt.core.dom package).
It would be nice to have some API to manipulate an aspect's AST like the JDT DOM AST does. This would indeed involve adding AST classes for aspects (Aspect, PointcutDeclaration, Advice, ...) and classes to create and modifiy them, something like AJAST.createAspect(...) or AJASTRewrite.rewrite(...) This could be quite useful for code generation tools or more simply aspects refactoring.
Infrastructure (not the entire feature...) is complete on this, thanks to a patch from Andrew Huff. Here is a program: import java.util.*; import org.aspectj.org.eclipse.jdt.core.dom.*; public class Program { public static void main(String []argv) { ASTParser parser = ASTParser.newParser(AST.JLS2); parser.setCompilerOptions(new HashMap()); parser.setSource(argv[0].toCharArray()); CompilationUnit cu2 = (CompilationUnit) parser.createAST(null); AjNaiveASTFlattener visitor = new AjNaiveASTFlattener(); cu2.accept(visitor); System.err.println(visitor.getResult()); } } I can now compile that program (outside of eclipse..) and if I run it: java Program "public aspect X { pointcut p(): call(* *(..));}" then it prints: public aspect X { pointcut p():call(* *(..)); } hurray! Now, the infrastructure is in place and quite a bit of the AST, but not all of it. In particular within pointcut expressions it isnt quite finished. In terms of rewriting pointcuts, the initial support is there for rewriting pointcut declarations (you could programmatically change p() above to be q()) - but beyond that nothing else has been implemented for aspects yet. We have no more cycles to put more in for AspectJ1.5.0 final, but there is more than enough there for some keen developer out there in open source land to help us complete it. I'm going to close this request because the infrastructure is complete, and open a new one for future work on the AST.
Hello, Please some one help me, How to extend AST AJDT Eclipse plugin for code smells detection in AOP/AspectJ applications. If this features in already present in the latest AJDT, tell me ,how to use it.
(In reply to comment #4) > Hello, > Please some one help me, How to extend AST AJDT Eclipse plugin for code smells > detection in AOP/AspectJ applications. > If this features in already present in the latest AJDT, tell me ,how to use it. Have a look at this page http://wiki.eclipse.org/Developer%27s_guide_to_building_tools_on_top_of_AJDT_and_AspectJ And then send any questions to the ajdt-dev mailing list. https://dev.eclipse.org/mailman/listinfo/ajdt-dev