diff options
author | wisberg <wisberg> | 2002-12-16 18:51:06 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2002-12-16 18:51:06 +0000 |
commit | 144143c2970a1e874d74cdbd0f8c622d4282a3c3 (patch) | |
tree | b12383d3d9e76c7e1f25f7fbec83051ef17f81fb /tests/jsrc | |
parent | fafae443719b26159ab2d7dac1c9b46b5e00b671 (diff) | |
download | aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip |
initial version
Diffstat (limited to 'tests/jsrc')
-rw-r--r-- | tests/jsrc/AroundAll.java | 11 | ||||
-rw-r--r-- | tests/jsrc/FindShowError.java | 25 | ||||
-rw-r--r-- | tests/jsrc/Trace.java | 32 | ||||
-rw-r--r-- | tests/jsrc/TraceAll.java | 3 | ||||
-rw-r--r-- | tests/jsrc/TraceCalls.java | 5 | ||||
-rw-r--r-- | tests/jsrc/TraceInstance.java | 3 | ||||
-rw-r--r-- | tests/jsrc/TraceMembers.java | 5 | ||||
-rw-r--r-- | tests/jsrc/TraceSets.java | 5 |
8 files changed, 89 insertions, 0 deletions
diff --git a/tests/jsrc/AroundAll.java b/tests/jsrc/AroundAll.java new file mode 100644 index 000000000..fadb9d4c2 --- /dev/null +++ b/tests/jsrc/AroundAll.java @@ -0,0 +1,11 @@ +aspect AroundAll { + pointcut targets(Object o) returns Object: + executions(!abstract !native * *(..)) && instanceof(o) && (within(java..*) || within(javax..*) || within(org.aspectj..*)); + + around(Object thisObj) returns Object: targets(thisObj) { + if (true) { + throw new RuntimeException("not meant to run"); + } + return proceed(thisObj); + } +} diff --git a/tests/jsrc/FindShowError.java b/tests/jsrc/FindShowError.java new file mode 100644 index 000000000..39fe6258d --- /dev/null +++ b/tests/jsrc/FindShowError.java @@ -0,0 +1,25 @@ +import org.aspectj.compiler.base.ast.*; + + + +aspect Wins { + + pointcut showError(ASTObject ast, String msg): target(ast) && call(void showError(msg)); + + void around(ASTObject ast, String msg): showError(ast, msg) { + System.out.println("hi"); + proceed(ast, msg); + } +} + +aspect Loses { + + pointcut showError(ASTObject ast, String msg): + within(org.aspectj.compiler..*) && target(ast) && call(void AST.showError(msg)); + + void around(ASTObject ast, String msg): showError(ast, msg) { + System.out.println("hi"); + proceed(ast, msg); + } +} + diff --git a/tests/jsrc/Trace.java b/tests/jsrc/Trace.java new file mode 100644 index 000000000..13f36d61d --- /dev/null +++ b/tests/jsrc/Trace.java @@ -0,0 +1,32 @@ +import java.io.Serializable; + +abstract aspect Trace { + abstract pointcut targets(); + + before (): targets() { + System.out.println("entering " + thisJoinPoint); + } + after (): targets() { + System.out.println("exiting " + + thisStaticJoinPoint); + } + + after () throwing (Throwable t): targets() { + System.out.println("throwing " + t); + } + + after () throwing (java.io.IOException ioe): targets() { + System.out.println("throwing " + ioe); + } + + after () returning (Object o): targets() { + System.out.println("returning " + o); + } + + + private static int initCounter() { + return 0; + } + + //private int Serializable.counter = initCounter(); +} diff --git a/tests/jsrc/TraceAll.java b/tests/jsrc/TraceAll.java new file mode 100644 index 000000000..b46c99d2c --- /dev/null +++ b/tests/jsrc/TraceAll.java @@ -0,0 +1,3 @@ +aspect TraceAll extends Trace of eachJVM() { + pointcut targets(): receptions(!native * *(..)) && (instanceof(java..*|| javax..* || org.aspectj..*)); +} diff --git a/tests/jsrc/TraceCalls.java b/tests/jsrc/TraceCalls.java new file mode 100644 index 000000000..4a0fa5db8 --- /dev/null +++ b/tests/jsrc/TraceCalls.java @@ -0,0 +1,5 @@ +aspect TraceCalls extends Trace of eachJVM() { + pointcut targets(): + (within(java..*) || within(javax..*) || within(org.aspectj..*)) && + (calls(* *(..)) || calls(new(..))); +} diff --git a/tests/jsrc/TraceInstance.java b/tests/jsrc/TraceInstance.java new file mode 100644 index 000000000..3a30e94bf --- /dev/null +++ b/tests/jsrc/TraceInstance.java @@ -0,0 +1,3 @@ +aspect TraceAll extends Trace { + pointcut targets(): receptions(!native * *(..)) && (instanceof(java..* || javax..*)); +} diff --git a/tests/jsrc/TraceMembers.java b/tests/jsrc/TraceMembers.java new file mode 100644 index 000000000..9f62a9129 --- /dev/null +++ b/tests/jsrc/TraceMembers.java @@ -0,0 +1,5 @@ +aspect TraceMembers extends Trace of eachJVM() { + pointcut targets(): + (within(java..*) || within(javax..*) || within(org.aspectj..*)) && + executions(!abstract !native * *(..)); +} diff --git a/tests/jsrc/TraceSets.java b/tests/jsrc/TraceSets.java new file mode 100644 index 000000000..306d2486f --- /dev/null +++ b/tests/jsrc/TraceSets.java @@ -0,0 +1,5 @@ +aspect TraceSets extends Trace of eachJVM() { + pointcut targets(): + (within(java..*) || within(javax..*) || within(org.aspectj..*)) && + sets(* *..*.*); +} |