aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2005-12-07 17:16:29 +0000
committeraclement <aclement>2005-12-07 17:16:29 +0000
commit283d2cdd5b5d8e38c63694597d90561c50400c18 (patch)
tree2f75e016f116c5e4936cbd577094264a2bcdc015
parenta7bc19f804487d6160c5f29eec94e2442e38957e (diff)
downloadaspectj-283d2cdd5b5d8e38c63694597d90561c50400c18.tar.gz
aspectj-283d2cdd5b5d8e38c63694597d90561c50400c18.zip
test for 119539
-rw-r--r--tests/bugs150/pr119539/GenericPerTypeWithin.java24
-rw-r--r--tests/bugs150/pr119539/GenericPerTypeWithin2.java24
-rw-r--r--tests/bugs150/pr119539/GenericPerTypeWithin3.java19
3 files changed, 67 insertions, 0 deletions
diff --git a/tests/bugs150/pr119539/GenericPerTypeWithin.java b/tests/bugs150/pr119539/GenericPerTypeWithin.java
new file mode 100644
index 000000000..c7ee849c2
--- /dev/null
+++ b/tests/bugs150/pr119539/GenericPerTypeWithin.java
@@ -0,0 +1,24 @@
+package bugs;
+
+public class GenericPerTypeWithin {
+ public static void main(String[] args) {
+ new C();
+ }
+}
+
+class C {
+ C() {}
+}
+class B {
+ B() {}
+}
+
+
+abstract aspect Singleton<Target> pertypewithin(Target) {
+ pointcut creation() : execution(Target+.new()) ;
+ pointcut creationOfAnything(): execution(*.new());
+ before() : creation() { }
+ before() : creationOfAnything() {} // should not match B.new() because of the ptw
+}
+
+aspect A extends Singleton<C> {}
diff --git a/tests/bugs150/pr119539/GenericPerTypeWithin2.java b/tests/bugs150/pr119539/GenericPerTypeWithin2.java
new file mode 100644
index 000000000..807f3d0ef
--- /dev/null
+++ b/tests/bugs150/pr119539/GenericPerTypeWithin2.java
@@ -0,0 +1,24 @@
+package bugs;
+
+public class GenericPerTypeWithin2 {
+ public static void main(String[] args) {
+ new C();
+ }
+}
+
+class C {
+ C() {}
+}
+class B {
+ B() {}
+}
+
+
+abstract aspect Singleton<Target> pertypewithin(Target) {
+ pointcut creation() : execution(Target+.new()) ;
+ pointcut creationOfAnything(): execution(*.new());
+ before() : creation() { }
+ before() : creationOfAnything() {} // should not match B.new() because of the ptw
+}
+
+aspect A extends Singleton {}
diff --git a/tests/bugs150/pr119539/GenericPerTypeWithin3.java b/tests/bugs150/pr119539/GenericPerTypeWithin3.java
new file mode 100644
index 000000000..ffc2ba3d7
--- /dev/null
+++ b/tests/bugs150/pr119539/GenericPerTypeWithin3.java
@@ -0,0 +1,19 @@
+package bugs;
+// this one matches the bug report ... apart from switching to before() advice as ctor-exec JPs have void return
+public class GenericPerTypeWithin3 {
+
+ public static void main(String[] args) {
+ new C(); // fyi, compiler does nothing absent this call?
+ }
+ public static abstract aspect Singleton<Target> pertypewithin(Target) {
+ pointcut creation() : execution(Target+.new()) ;
+ before() : creation() { }
+ // picks out constructor-execution below
+ declare warning : creation() : "Singleton.creation()";
+ }
+ static class C {
+ C(){}
+ }
+ static aspect A extends Singleton<C> {}
+
+} \ No newline at end of file