diff options
author | jhugunin <jhugunin> | 2003-07-16 23:19:54 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2003-07-16 23:19:54 +0000 |
commit | 13b319a40f353f3c07eb0a7c4a40f3e3f6381573 (patch) | |
tree | b7fba5c142a0c52b7863179e4904f2c3274bb1dd /tests/bugs | |
parent | cd9946a959b393d386ea893f007b9cd2adbac74c (diff) | |
download | aspectj-13b319a40f353f3c07eb0a7c4a40f3e3f6381573.tar.gz aspectj-13b319a40f353f3c07eb0a7c4a40f3e3f6381573.zip |
Fix for Bugzilla #39479, #40109
based on patch contributed by Andy Clement
Generalizes the patch with a method org.aspectj.weaver.bcel.Utility.copyInstruction
that works-around the bug in Select.copy(). Changed all calls to
Instruction.copy() to use this new method, would be nice to add the
rule:
* declare error:
* call(* Instruction.copy()) && within(org.aspectj.weaver)
* && !withincode(* Utility.copyInstruction(Instruction)):
* "use Utility.copyInstruction to work-around bug in Select.copy()";
Diffstat (limited to 'tests/bugs')
-rw-r--r-- | tests/bugs/SwitchInAround.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/bugs/SwitchInAround.java b/tests/bugs/SwitchInAround.java new file mode 100644 index 000000000..c86d71a3c --- /dev/null +++ b/tests/bugs/SwitchInAround.java @@ -0,0 +1,27 @@ +import org.aspectj.testing.Tester; + +public class SwitchInAround { + public static void main(String[] args) { + SwitchInAround o = new SwitchInAround(); + Tester.checkEqual(o.doit(1), "1"); + Tester.checkEqual(o.doit(2), "2"); + Tester.checkEqual(o.doit(3), "default"); + } + + public String doit(int i) { + return "doit"; + } +} + +privileged aspect A { + String around(int index): args(index) && call(String doit(int)) { + switch(index) { + case 1: + return "1"; + case 2: + return "2"; + default: + return "default"; + } + } +}
\ No newline at end of file |