選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

CallsParams.java 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import org.aspectj.testing.Tester;
  2. import java.util.*;
  3. public class CallsParams {
  4. public static void main(String[] args) {
  5. Test t = new Test();
  6. t.go();
  7. //Tester.checkEqual(Test.calls, ", Test.go->Test.foo, Test.foo->java.io.PrintStream.println");
  8. Tester.checkEqual(Test.calls, ", Test.go->foo, Test.foo->println");
  9. }
  10. }
  11. class Test {
  12. static String calls = "";
  13. void go(){
  14. foo();
  15. }
  16. void foo(){
  17. System.out.println("");
  18. }
  19. }
  20. aspect SeqCut percflow(call(* Test.go(..))) {
  21. //before(Object s, Object r) : !instanceof(SeqCut) && instanceof(s) && calls(* r.*(..)) {
  22. before(Object s, Object r) : !this(SeqCut) && this(s) &&
  23. //callsto(receptions(* *(..)) && instanceof(r)) {
  24. call(* *(..)) && target(r) {
  25. Test.calls += ", " + s.getClass().getName() + "." +
  26. //thisJoinPoint.getEnclosingExecutionJoinPoint().getSignature().getName() +
  27. thisEnclosingJoinPointStaticPart.getSignature().getName() +
  28. "->" /*+ r.getClass().getName() + "."*/ + thisJoinPoint.getSignature().getName();
  29. // IBM's VM doesn't have a java.io.PrintStream :)
  30. }
  31. before(Object s) : !this(SeqCut) && this(s) && call(* *..*.*(..)) {
  32. // no output
  33. //System.out.println(", " + s.getClass().getName() + "." + thisStaticJoinPoint.getSignature().getName());
  34. }
  35. }