diff options
Diffstat (limited to 'tests/bugs152/pr122253/Singleton.java')
-rw-r--r-- | tests/bugs152/pr122253/Singleton.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/bugs152/pr122253/Singleton.java b/tests/bugs152/pr122253/Singleton.java new file mode 100644 index 000000000..e28ec25d8 --- /dev/null +++ b/tests/bugs152/pr122253/Singleton.java @@ -0,0 +1,27 @@ +import org.aspectj.lang.*; + +public aspect Singleton { + + before(): execution(* Foo.*(..)) {} + + public static void main(String []argv) { + print(); + new Foo().m(); + print(); + } + + public static void print() { + boolean b1 = Aspects14.hasAspect(Singleton.class); + boolean b2 = Singleton.hasAspect(); + Object o1 = (b1?Aspects14.aspectOf(Singleton.class):null); + Object o2 = (b2?Singleton.aspectOf():null); + System.err.println("hasAspect? "+b1+" : "+b2); + System.err.println("aspectOf? "+o1+" : "+o2); + } + + public String toString() { return "SingletonInstance"; } +} + +class Foo { + public void m() { } +} |