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/base/test141 | |
parent | fafae443719b26159ab2d7dac1c9b46b5e00b671 (diff) | |
download | aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip |
initial version
Diffstat (limited to 'tests/base/test141')
-rw-r--r-- | tests/base/test141/Driver.java | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/tests/base/test141/Driver.java b/tests/base/test141/Driver.java new file mode 100644 index 000000000..0bf61f906 --- /dev/null +++ b/tests/base/test141/Driver.java @@ -0,0 +1,60 @@ +// thisResultObject for primitives +// I think this is a bad test. Is there a way to do this? -eh + +import org.aspectj.testing.Tester; + +public class Driver { + public static void test() { + C1 c1 = new C1(); + + c1.getInteger(); + c1.getDouble(); + c1.getVoid(); + c1.getString(); + c1.getBoolean(); + } + + public static void main(String[] args) { test(); } +} + +class C1 { + int getInteger() { + return 1; + } + + double getDouble() { + return 3.14; + } + + void getVoid() { + } + + String getString() { + return "Hello World"; + } + + boolean getBoolean() { + return true; + } +} + +aspect A1 { + // don't advise the finalize reception, or weird interactions with GC can happen + after() returning (Object result): + target(C1) && call(* *()) && !call(void finalize()) { + if (result == null) { + Tester.checkEqual(thisJoinPoint.getSignature().getName(), + "getVoid", + "void method"); + } + else { + String resultClassName = result.getClass().getName(); + + Tester.checkEqual("java.lang." + + thisJoinPoint.getSignature().getName().substring(3), + resultClassName, + "result object type"); + } + } +} + |