diff options
author | aclement <aclement> | 2005-11-03 10:31:03 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-11-03 10:31:03 +0000 |
commit | 4b5e76347445be5180616f5008e52328948b6cf5 (patch) | |
tree | c8a734eb911a4ea1d4b5924290d9b51f86223825 /tests | |
parent | ade32bc38c17b38811b617f54828feb43a4b7048 (diff) | |
download | aspectj-4b5e76347445be5180616f5008e52328948b6cf5.tar.gz aspectj-4b5e76347445be5180616f5008e52328948b6cf5.zip |
fix for latest variant of 114343 (see comment #5): around advice on method returning type variable.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bugs150/pr114343/case2/TTT.java | 11 | ||||
-rw-r--r-- | tests/bugs150/pr114343/case2/Test.java | 11 | ||||
-rw-r--r-- | tests/bugs150/pr114343/case2/TestAspect.java | 25 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java | 1 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/ajc150.xml | 15 |
5 files changed, 63 insertions, 0 deletions
diff --git a/tests/bugs150/pr114343/case2/TTT.java b/tests/bugs150/pr114343/case2/TTT.java new file mode 100644 index 000000000..732e0d38e --- /dev/null +++ b/tests/bugs150/pr114343/case2/TTT.java @@ -0,0 +1,11 @@ +import java.util.*; + +public class TTT { + public void foo() { + System.err.println("Creating Test<Integer> instance"); + Test<Integer> mt = new Test<Integer>(); + System.err.println("Calling toArray"); + Integer[] arr = mt.toArray(new Integer[]{}); + System.err.println("done"); + } +} diff --git a/tests/bugs150/pr114343/case2/Test.java b/tests/bugs150/pr114343/case2/Test.java new file mode 100644 index 000000000..758094997 --- /dev/null +++ b/tests/bugs150/pr114343/case2/Test.java @@ -0,0 +1,11 @@ +import java.util.*; + +public class Test<T> { + + Set<T> set = new HashSet<T>(); + + public <T> T[] toArray(T[] a) { + System.err.println("In toArray()"); + return set.toArray(a); + } +} diff --git a/tests/bugs150/pr114343/case2/TestAspect.java b/tests/bugs150/pr114343/case2/TestAspect.java new file mode 100644 index 000000000..fcc760ac7 --- /dev/null +++ b/tests/bugs150/pr114343/case2/TestAspect.java @@ -0,0 +1,25 @@ +import java.util.*; + +public privileged aspect TestAspect { + + pointcut TestToArray(Test mt) : + target(mt) && + !within(TestAspect); + + + Object[] around(Test mt, Object[] objs) : + TestToArray(mt) && + args(objs) && + execution(Object[] Test.toArray(Object[])) { + + System.err.println("In around advice"); + objs = proceed(mt, objs); + return objs; + } + + public static void main(String[] argv) { + System.err.println("TestAspect.main: Calling foo"); + new TTT().foo(); + System.err.println("TestAspect.main: done"); + } +} diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java index 54677b88c..c3a77ad2e 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java @@ -56,6 +56,7 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase { public void testMatthewsAspect_pr113947_1() { runTest("maws generic aspect - 1");} public void testMatthewsAspect_pr113947_2() { runTest("maws generic aspect - 2");} public void testFieldGet_pr114343() { runTest("field-get, generics and around advice");} + public void testFieldGet_pr114343_2() { runTest("field-get, generics and around advice - 2");} public void testCaptureBinding_pr114744() { runTest("capturebinding wildcard problem");} public void testBadDecp_pr110788_1() { runTest("bad generic decp - 1");} diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index 852ccb981..8d10e7563 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -29,6 +29,21 @@ <run class="TestAspect"/> </ajc-test> + <ajc-test dir="bugs150/pr114343/case2" title="field-get, generics and around advice - 2"> + <compile files="Test.java,TTT.java,TestAspect.java" options="-1.5"/> + <run class="TestAspect"> + <stderr> + <line text="TestAspect.main: Calling foo"/> + <line text="Creating Test<Integer> instance"/> + <line text="Calling toArray"/> + <line text="In around advice"/> + <line text="In toArray()"/> + <line text="done"/> + <line text="TestAspect.main: done"/> + </stderr> + </run> + </ajc-test> + <ajc-test dir="bugs150/pr113947/case1" title="maws generic aspect - 1"> <compile files="AbstractListSupport.java,AnotherItem.java,Item.java,LinkedList.java,LinkedListItem.java,ListItem.java,StringList.java" options="-1.5"> <!-- the 'static ref' messages are a bit poor and ought to be eliminated... --> |