From: aclement Date: Fri, 21 Apr 2006 17:55:11 +0000 (+0000) Subject: testcode for 137496: problem with join point matching on calls to parameterized methods X-Git-Tag: V1_5_2rc1~195 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=5b354c21ff2b4754522f75324f8094958804a753;p=aspectj.git testcode for 137496: problem with join point matching on calls to parameterized methods --- diff --git a/tests/bugs152/pr137496/B.java b/tests/bugs152/pr137496/B.java new file mode 100644 index 000000000..5351ed327 --- /dev/null +++ b/tests/bugs152/pr137496/B.java @@ -0,0 +1,28 @@ +interface P { + public T pm(T t); +// public String pm2(String t); +} + +interface C extends P { + public void cm(); +} + +class CImpl implements C { + public void cm() {} + public String pm(String s) { System.err.println(s);return s;} +// public String pm2(String s) { return s;} +} + +public class B { + + public static void main(String []argv) { + C test = new CImpl(); + test.pm("foo"); // manifests as 'Object pm(Object) call' due to type C being used +// test.pm2("foo"); + } +} + +aspect X { + before(): call(* pm(..)) { System.err.println("advice");} +// before(): call(* pm2(..)) {} +} \ No newline at end of file diff --git a/tests/bugs152/pr137496/D.java b/tests/bugs152/pr137496/D.java new file mode 100644 index 000000000..db6cad514 --- /dev/null +++ b/tests/bugs152/pr137496/D.java @@ -0,0 +1,28 @@ +interface P { + public T pm(T t); + public String pm2(String t); +} + +interface C extends P { + public void cm(); +} + +class CImpl implements C { + public void cm() {} + public String pm(String s) { System.err.println(s);return s;} + public String pm2(String s) { System.err.println(s);return s;} +} + +public class D { + + public static void main(String []argv) { + CImpl test = new CImpl(); + test.pm("foo"); // manifests as 'String pm(String) call' due to type CImpl being used + test.pm2("foo"); + } +} + +aspect X { + before(): call(* pm(..)) { System.err.println("advice");} + before(): call(* pm2(..)) { System.err.println("advice2");} +} \ No newline at end of file diff --git a/tests/bugs152/pr137496/E.java b/tests/bugs152/pr137496/E.java new file mode 100644 index 000000000..2abfed94d --- /dev/null +++ b/tests/bugs152/pr137496/E.java @@ -0,0 +1,24 @@ +interface P { + public T pm(T t); +} + +interface C extends P { + public void cm(); +} + +class CImpl implements C { + public void cm() {} + public String pm(String s) { System.err.println(s);return s;} +} + +public class E { + + public static void main(String []argv) { + C test = new CImpl(); + test.pm("foo"); // manifests as 'Object pm(Object) call' due to type C being used + } +} + +aspect X { + before(): call(* pm(String)) { System.err.println("advice");} // matches? +} \ No newline at end of file diff --git a/tests/bugs152/pr137496/F.java b/tests/bugs152/pr137496/F.java new file mode 100644 index 000000000..6960646aa --- /dev/null +++ b/tests/bugs152/pr137496/F.java @@ -0,0 +1,24 @@ +interface P { + public T pm(T t); +} + +interface C extends P { + public void cm(); +} + +class CImpl implements C { + public void cm() {} + public String pm(String s) { System.err.println(s);return s;} +} + +public class F { + + public static void main(String []argv) { + C test = new CImpl(); + test.pm("foo"); // manifests as 'Object pm(Object) call' due to type C being used + } +} + +aspect X { + before(): call(String pm(..)) { System.err.println("advice");} // matches? +} \ No newline at end of file diff --git a/tests/bugs152/pr137496/G.java b/tests/bugs152/pr137496/G.java new file mode 100644 index 000000000..fd566dfe5 --- /dev/null +++ b/tests/bugs152/pr137496/G.java @@ -0,0 +1,24 @@ +interface P { + public T pm(T t); +} + +interface C extends P { + public void cm(); +} + +class CImpl implements C { + public void cm() {} + public String pm(String s) { System.err.println(s);return s;} +} + +public class G { + + public static void main(String []argv) { + C test = new CImpl(); + test.pm("foo"); // manifests as 'Object pm(Object) call' due to type C being used + } +} + +aspect X { + before(): call(* pm(Object)) { System.err.println("advice");} // no match... +} \ No newline at end of file diff --git a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java index bff94e8cd..0e812f5d4 100644 --- a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java @@ -17,6 +17,11 @@ import org.aspectj.testing.XMLBasedAjcTestCase; public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase { + public void testPointcutsAndGenerics_pr137496_1() { runTest("pointcuts and generics - B");} + public void testPointcutsAndGenerics_pr137496_2() { runTest("pointcuts and generics - D");} + public void testPointcutsAndGenerics_pr137496_3() { runTest("pointcuts and generics - E");} + public void testPointcutsAndGenerics_pr137496_4() { runTest("pointcuts and generics - F");} + public void testPointcutsAndGenerics_pr137496_5() { runTest("pointcuts and generics - G");} public void testAspectLibrariesAndASM_pr135001() { runTest("aspect libraries and asm");} public void testStackOverflow_pr136258() { runTest("stack overflow");} public void testIncorrectOverridesEvaluation13() { runTest("incorrect overrides evaluation - 1.3"); } diff --git a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml index 7ee33b766..2c9bd484b 100644 --- a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml +++ b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml @@ -20,6 +20,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +