diff options
Diffstat (limited to 'tests/other-systems/util/Trace.java')
-rw-r--r-- | tests/other-systems/util/Trace.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/tests/other-systems/util/Trace.java b/tests/other-systems/util/Trace.java new file mode 100644 index 000000000..72aa89b20 --- /dev/null +++ b/tests/other-systems/util/Trace.java @@ -0,0 +1,37 @@ +import java.io.Serializable; + +abstract aspect Trace { + abstract pointcut targets(); + + /* + * toString() can throw exceptions, so we'll print + * the java.lang.Class instead. + */ + + before (): targets() { + System.out.println("entering " + thisJoinPoint); + } + after (): targets() { + System.out.println("exiting " + + thisJoinPointStaticPart); + } + + 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!=null ? o.getClass() : null)); + } + + + private static int initCounter() { + return 0; + } + + //private int Serializable.counter = initCounter(); +} |