--- /dev/null
+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> {}
--- /dev/null
+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 {}
--- /dev/null
+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