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/new/InvalidProceedArgsCE.java | |
parent | fafae443719b26159ab2d7dac1c9b46b5e00b671 (diff) | |
download | aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip |
initial version
Diffstat (limited to 'tests/new/InvalidProceedArgsCE.java')
-rw-r--r-- | tests/new/InvalidProceedArgsCE.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/new/InvalidProceedArgsCE.java b/tests/new/InvalidProceedArgsCE.java new file mode 100644 index 000000000..388d31e9d --- /dev/null +++ b/tests/new/InvalidProceedArgsCE.java @@ -0,0 +1,48 @@ + +class Target { + public void resize(int i) {} +} + +/** @testcase invalid number and type of proceed arguments */ +aspect A { + void around(Target buffer) + : call(void Target.resize(..)) && target(buffer) { + proceed(); // expect CE here + } + void around(int i, Target buffer) + : call(void Target.resize(..)) && args(i) && target(buffer) { + /** @testcase invalid proceed args - none, 2 expected */ + proceed(); // expect CE here + /** @testcase invalid proceed args - 1, 2 expected */ + proceed(i); // expect CE here + // coercion is passing + /** @testcase invalid proceed args - wrong type 1, 2 expected */ + proceed(buffer); // expect CE here + /** @testcase invalid proceed args - wrong type 2, 2 expected */ + proceed(buffer, i); // expect CE here + } + void around(int i) + : call(void Target.resize(..)) && args(i) { + /** @testcase invalid proceed args - wrong type */ + proceed(new Integer(0)); // expect CE here + /** @testcase invalid proceed args - wrong type 2, 1 expected */ + proceed(new Integer(0), 0); // expect CE here + /** @testcase invalid proceed args - wrong type 2, 1 expected */ + proceed(0, new Integer(0)); // expect CE here + } + + void around(int i, Target buffer) + : call(void Target.resize(..)) && args(i) && target(buffer) { + /** @testcase invalid proceed args - float -> int */ + proceed(3.1, buffer); // expect CE here + /** @testcase invalid proceed args - String -> int */ + proceed("1", buffer); // expect CE here + proceed('a', buffer); // char -> int is legal + // coercion is passing + /** @testcase invalid proceed args - Object -> Target */ + proceed(i, (Object)null); // expect CE here + proceed(i, null); //null -> Target is legal + /** @testcase invalid proceed args - wrong type 3-> Target */ + proceed(i, 3); // expect CE here + } +} |