AspectJ is an open source implementation of AOP. The simplest thing it can be used for is a compilation time policy enforcement. The example that will force the compiler to produce a warning when ever
System.out or
System.err are referenced follows:
package com.custommode.aspectj;
/**
* @author damelchenko
* @since Jun 15, 2004
*/
public aspect SysOutWarning {
declare warning : get(* System.out) || get(* System.err):
"Consider using log4j instead";
}Similar technique can be used to enforse jdbc accerss policies e.t.c...
AspectJ has a great integration with Eclipse.
Some more advanced things that can be done with AspectJ are like implementing
Multiple Inheritance in Java. Actually it's so simple with AspectJ it's hardly can be called advanced.