aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/SourceLocationCall.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/new/SourceLocationCall.java')
-rw-r--r--tests/new/SourceLocationCall.java58
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/new/SourceLocationCall.java b/tests/new/SourceLocationCall.java
new file mode 100644
index 000000000..a1ab48eff
--- /dev/null
+++ b/tests/new/SourceLocationCall.java
@@ -0,0 +1,58 @@
+
+import org.aspectj.testing.Tester;
+import org.aspectj.lang.*;
+
+/** @testcase PR#658 simple call join point tests for JoinPoint SourceLocation context */
+public class SourceLocationCall {
+ public static void main(String[] args) {
+ new SourceLocationCall().maincall();
+ }
+ public void maincall(){}
+}
+
+aspect Tracing {
+ static void check(String label, JoinPoint jp, JoinPoint.StaticPart sp) {
+// System.err.println("checking " + label + " " + jp + " " + sp
+// + " - " + jp.getSourceLocation()
+// + " - " + sp.getSourceLocation() );
+ if (null == jp) {
+ Tester.check(false, "null JoinPoint@" + label);
+ } else {
+ Tester.check(null != jp.getSourceLocation(),
+ "null jp source location@" + label);
+ }
+ if (null == sp) {
+ Tester.check(false, "null JoinPoint.StaticPart@"+label);
+ } else {
+ Tester.check(null != sp.getSourceLocation(),
+ "null sp source location@" + label);
+ }
+ }
+ pointcut trace1()
+ : call(void SourceLocationCall.maincall(..));
+ // ok
+ //: within(SourceLocationCall) ;
+ //: cflow(execution(void SourceLocationCall.main(String[]))) && !within(Tracing) ;
+ //: within(SourceLocationCall) && call(* *(..));
+ //: execution(* SourceLocationCall.*(..));
+ //: call(void SourceLocationCall.main*(..)) && within(*);
+ // fail
+ //: call(void SourceLocationCall.main*(..));
+ //: call(* SourceLocationCall.*(..));
+ //: call(void SourceLocationCall.*(..));
+ // same result for static calls and instance calls
+ // same result for before and after
+ before() : trace1() {
+ check("before() : trace1()", thisJoinPoint, thisJoinPointStaticPart);
+ }
+ after() : trace1() {
+ check("after() : trace1()", thisJoinPoint, thisJoinPointStaticPart);
+ }
+
+ before(): call(void SourceLocationCall.main(..)) {
+ Tester.check(thisJoinPoint.getSourceLocation() == null, "main call");
+ Tester.check(thisJoinPoint.getThis() == null, "main call");
+ }
+}
+
+