aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs150/pr119539/GenericPerTypeWithin3.java
blob: ffc2ba3d71eeace8b1041ac96c2867de2283261c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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> {}
    
}