diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/bugs150/pr119749.aj | 62 | ||||
-rw-r--r-- | tests/java5/annotations/ajdkExamples/AnnotationInheritance.aj | 2 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java | 4 | ||||
-rw-r--r-- | tests/src/org/aspectj/systemtest/ajc150/ajc150.xml | 21 |
4 files changed, 87 insertions, 2 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 diff --git a/tests/java5/annotations/ajdkExamples/AnnotationInheritance.aj b/tests/java5/annotations/ajdkExamples/AnnotationInheritance.aj index 2ca13eba4..1a437183b 100644 --- a/tests/java5/annotations/ajdkExamples/AnnotationInheritance.aj +++ b/tests/java5/annotations/ajdkExamples/AnnotationInheritance.aj @@ -23,7 +23,7 @@ pointcut annotatedC2MethodCall() : call(@SomeAnnotation * C2.aMethod()); // matches nothing - pointcut annotatedMethodCall() : // CW L16, L17 + pointcut annotatedMethodCall() : // CW L16 call(@SomeAnnotation * aMethod()); declare warning : annotatedC2MethodCall() : "annotatedC2MethodCall()"; diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java index d5c3c2bdc..bc7d7e683 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java @@ -847,6 +847,10 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase { runTest("reflection on @DeclareParents"); } + public void testModifierOverrides() { + runTest("modifier overrides"); + } + // helper methods..... public SyntheticRepository createRepos(File cpentry) { diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml index 19bcb55a9..d6814e28e 100644 --- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml +++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml @@ -6,6 +6,25 @@ <compile files="pr118698.aj"/> <run class="pr118698"/> </ajc-test> + + <ajc-test dir="bugs150" title="modifier overrides"> + <compile files="pr119749.aj" options="-1.5"> + <message kind="warning" line="26" text="C E.*()"/> + <message kind="warning" line="25" text="D E.*()"/> + <message kind="warning" line="17" text="aa @Me void m()"/> + <message kind="warning" line="17" text="aa void m() throws Exception"/> + <message kind="warning" line="17" text="aa * *(..) throws Exception"/> + <message kind="warning" line="37" text="aa call void m() throws Exception"/> + <message kind="warning" line="38" text="aa call void m() throws Exception"/> + </compile> + <run class="pr119749"> + <stdout> + <line text="execution(void pr119749.C.m()): execMe[@pr119749$Me()]"/> + <line text="execution(void pr119749.C.m()): execEx"/> + </stdout> + </run> + </ajc-test> + <ajc-test dir="bugs150/pr112476/case1" title="binary weaving decp broken"> <compile files="lib/A.java,lib/B.java,lib/C.java" outjar="library.jar" options="-1.5"/> @@ -2683,7 +2702,7 @@ <ajc-test dir="java5/annotations/ajdkExamples" title="ajdk: @inherited"> <compile files="AnnotationInheritance.aj" options="-1.5"> <message kind="warning" line="16" text="annotatedMethodCall()"/> - <message kind="warning" line="17" text="annotatedMethodCall()"/> + <!-- <message kind="warning" line="17" text="annotatedMethodCall()"/> --> </compile> </ajc-test> |