From: aclement Date: Thu, 3 Nov 2005 11:05:52 +0000 (+0000) Subject: test for 114343 (see comment #5): another potential case X-Git-Tag: V1_5_0RC1~270 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=23f126227121adeaa5615cf94d8afa57a577120b;p=aspectj.git test for 114343 (see comment #5): another potential case --- diff --git a/tests/bugs150/pr114343/case3/TTT.java b/tests/bugs150/pr114343/case3/TTT.java new file mode 100644 index 000000000..c822a1cbb --- /dev/null +++ b/tests/bugs150/pr114343/case3/TTT.java @@ -0,0 +1,20 @@ +import java.util.*; + +public class TTT { + public void foo() { + System.err.println("Creating Test instance"); + Test mt = new Test(); + System.err.println("Calling toArray"); + Integer[] arr = mt.toArray(new Integer[]{}); + System.err.println("done"); + } + + public Integer getFirst() { + System.err.println("Creating Test instance"); + Test mt = new Test(); + System.err.println("Calling getFirst"); + Integer i = mt.getFirst(); + System.err.println("done"); + return i; + } +} diff --git a/tests/bugs150/pr114343/case3/Test.java b/tests/bugs150/pr114343/case3/Test.java new file mode 100644 index 000000000..2634cd915 --- /dev/null +++ b/tests/bugs150/pr114343/case3/Test.java @@ -0,0 +1,16 @@ +import java.util.*; + +public class Test { + + Set set = new HashSet(); + T t = null; + + public T[] toArray(T[] a) { + System.err.println("In toArray()"); + return set.toArray(a); + } + + public T getFirst() { + return t; + } +} diff --git a/tests/bugs150/pr114343/case3/TestAspect.java b/tests/bugs150/pr114343/case3/TestAspect.java new file mode 100644 index 000000000..6d82c0f0e --- /dev/null +++ b/tests/bugs150/pr114343/case3/TestAspect.java @@ -0,0 +1,32 @@ +import java.util.*; + +public privileged aspect TestAspect { + + pointcut TestToArray(Test mt) : target(mt) && !within(TestAspect); + + pointcut getFirstExec(Test mt) : + execution(* getFirst(..)) && 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; + } + + Object around(Test mt): getFirstExec(mt) { + System.err.println("around on getFirstExec(): running"); + return proceed(mt); + } + + + public static void main(String[] argv) { + System.err.println("TestAspect.main: Calling foo"); + new TTT().foo(); + Object o = new TTT().getFirst(); + 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 c3a77ad2e..82de22113 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java @@ -57,6 +57,7 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase { 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 testFieldGet_pr114343_3() { runTest("field-get, generics and around advice - 3");} 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 8d10e7563..bd5016402 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -44,6 +44,25 @@ + + + + + + + + + + + + + + + + + + +