diff options
author | jhugunin <jhugunin> | 2003-01-07 20:49:38 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2003-01-07 20:49:38 +0000 |
commit | 1e721079e0cec90516b4629272c178ff377ec75b (patch) | |
tree | 4461efd429afe8ea0e319a5d028010d789b787c9 /tests/bugs/CloseConnectionsCflow.java | |
parent | 2b680c46c54d8d5c3069b29686282d7fff720b1c (diff) | |
download | aspectj-1e721079e0cec90516b4629272c178ff377ec75b.tar.gz aspectj-1e721079e0cec90516b4629272c178ff377ec75b.zip |
tests from bugzilla
Diffstat (limited to 'tests/bugs/CloseConnectionsCflow.java')
-rw-r--r-- | tests/bugs/CloseConnectionsCflow.java | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/bugs/CloseConnectionsCflow.java b/tests/bugs/CloseConnectionsCflow.java new file mode 100644 index 000000000..10f0e330e --- /dev/null +++ b/tests/bugs/CloseConnectionsCflow.java @@ -0,0 +1,57 @@ +// Bug # 28702 + +import java.util.Stack; + + + +interface Connection { + + Connection open(); + + void close(); + +} + + + +aspect CloseConnectionsCflow percflow(layerEntryMethods()) { + + Stack openConnections; + + pointcut layerMethods() : + + execution(public * com.example.businessFacade.*.*(..)); + + pointcut layerEntryMethods() : + + layerMethods() && !cflowbelow(layerMethods()); + + pointcut openedConnection() : + + call(* Connection.open(..)); + + pointcut layerBoundary() : cflow(layerEntryMethods()); + + + + after() returning (Connection conn) : + + openedConnection() && layerBoundary() { + + openConnections.push(conn); + + } + + after() : layerBoundary() { + + while (!openConnections.empty()) { + + Connection conn = (Connection)openConnections.pop(); + + conn.close(); + + } + + } + +} |