diff options
author | acolyer <acolyer> | 2005-12-13 22:19:08 +0000 |
---|---|---|
committer | acolyer <acolyer> | 2005-12-13 22:19:08 +0000 |
commit | b7929e91659708dc27141f587ad236af7bfa8287 (patch) | |
tree | 4ab9a88305479e154a499077ef4978fe7d33242d /tests/bugs150 | |
parent | e50bf403b26657b4b39a6be0e34b7170dbc788a9 (diff) | |
download | aspectj-b7929e91659708dc27141f587ad236af7bfa8287.tar.gz aspectj-b7929e91659708dc27141f587ad236af7bfa8287.zip |
tests and fix for pr119749
Diffstat (limited to 'tests/bugs150')
-rw-r--r-- | tests/bugs150/pr119749.aj | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/tests/bugs150/pr119749.aj b/tests/bugs150/pr119749.aj new file mode 100644 index 000000000..dc3cc4bb5 --- /dev/null +++ b/tests/bugs150/pr119749.aj @@ -0,0 +1,62 @@ + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +import org.aspectj.lang.JoinPoint; + +public aspect pr119749 { + // not inherited + @Retention(RetentionPolicy.RUNTIME) + @Target(ElementType.METHOD) + @interface Me{} + + static class C { + @Me() + void m() throws Exception {} + } + + static class D extends C{ + void m() {} + } + + static class E { + D d(){return null;} + C c(){return null;} + static aspect A { + declare warning: execution(C E.*()) : "C E.*()"; //L26 + declare warning: execution(D E.*()) : "D E.*()"; // L25 + } + } + + public static void main(String[] args) { + C c = new C(); + D d = new D(); + C cd = d; + try {c.m();} catch (Exception e) {} + try {cd.m();} catch (Exception e) {} + d.m(); + } + + static aspect A { + static void log(JoinPoint jp, Object o) { + System.out.println("" + jp + ": " + o); + } + pointcut scope() : within(pr119749); + pointcut execMe() :execution(@Me void m()) && scope(); // L17 + pointcut execEx() :execution(void m() throws Exception) && scope(); // L17 + pointcut execAnyEx() :execution(* *(..) throws Exception) && scope(); // L17 + pointcut callEx() :call(void m() throws Exception) && scope(); // L37,38 + declare warning : execMe() : "aa @Me void m()"; + declare warning : execEx() : "aa void m() throws Exception"; + declare warning : execAnyEx() : "aa * *(..) throws Exception"; + declare warning : callEx() : "aa call void m() throws Exception"; + before(Me me) : @annotation(me) && execMe() { + log(thisJoinPoint, "execMe[" + me + "]"); + } + before() : execEx() { + log(thisJoinPoint, "execEx"); + } + } +}
\ No newline at end of file |