Friday, May 27, 2005

Code compliance checker with AspectJ

My First application with AspectJ.. I developed a code compliance checker that checks for System.out.println in the code and reports itz usage. Can you believe that the following few lines of code did the magic, indeed they did!

public aspect Checker
{
pointcut sopReporter() :
call(void java.io.PrintStream.print*(..)) &&
within(com.trial03.*) && !within(Checker);


before() : sopReporter()
{
System.out.println("!!!!! STOP USINg System.out.println() !!!");
}

}

AspectJ is really cool and I'm lovin it !!!

No comments: