You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

EachJVMOnSelf.java 419B

21 years ago
21 years ago
1234567891011121314151617181920
  1. import org.aspectj.testing.Tester;
  2. public class EachJVMOnSelf {
  3. public static void main(String[] args) {
  4. new C();
  5. Tester.checkEqual(A.aspectOf().advisedNewClass, "C");
  6. }
  7. }
  8. aspect A issingleton() {
  9. String advisedNewClass = null;
  10. after () returning (): this(*) && execution(new(..)) && !this(A) {
  11. advisedNewClass = thisJoinPoint.getSourceLocation().getWithinType().getName();
  12. }
  13. }
  14. class C {
  15. }