]> source.dussan.org Git - aspectj.git/commitdiff
test code for 158126 - already fixed ;) just a nice test to have
authoraclement <aclement>
Thu, 21 Sep 2006 13:03:02 +0000 (13:03 +0000)
committeraclement <aclement>
Thu, 21 Sep 2006 13:03:02 +0000 (13:03 +0000)
tests/bugs153/pr158126/A.java [new file with mode: 0644]
tests/bugs153/pr158126/B.java [new file with mode: 0644]
tests/bugs153/pr158126/MyAnnotation.java [new file with mode: 0644]
tests/bugs153/pr158126/MyAspect.java [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc153/Ajc153Tests.java
tests/src/org/aspectj/systemtest/ajc153/ajc153.xml

diff --git a/tests/bugs153/pr158126/A.java b/tests/bugs153/pr158126/A.java
new file mode 100644 (file)
index 0000000..d92c77f
--- /dev/null
@@ -0,0 +1,17 @@
+public class A {
+
+        @MyAnnotation
+        public A() {
+                new B();
+        }
+
+        @MyAnnotation
+        public A(int i) {
+                new B(i);
+        }
+
+        public static void main(String[] args) {
+                new A();
+                new A(1);
+        }
+}
diff --git a/tests/bugs153/pr158126/B.java b/tests/bugs153/pr158126/B.java
new file mode 100644 (file)
index 0000000..bdbfa78
--- /dev/null
@@ -0,0 +1,12 @@
+public class B {
+
+        @MyAnnotation
+        public B() {
+
+        }
+
+        @MyAnnotation
+        public B(int i) {
+
+        }
+}
diff --git a/tests/bugs153/pr158126/MyAnnotation.java b/tests/bugs153/pr158126/MyAnnotation.java
new file mode 100644 (file)
index 0000000..33d13ea
--- /dev/null
@@ -0,0 +1,7 @@
+import java.lang.annotation.*;
+
+@Target(ElementType.CONSTRUCTOR)
+@Retention(RetentionPolicy.RUNTIME)
+public @interface MyAnnotation {
+
+}
diff --git a/tests/bugs153/pr158126/MyAspect.java b/tests/bugs153/pr158126/MyAspect.java
new file mode 100644 (file)
index 0000000..0ab4a32
--- /dev/null
@@ -0,0 +1,7 @@
+public aspect MyAspect {
+
+        before() :
+                call(@MyAnnotation *.new(..)) {
+                System.out.println(thisJoinPoint);
+        }
+}
index 4c8fdd0cdd12f6653f41fb8301f76ae9c6ffbada..7e6c95f56864cf233f358c79f0dbc88b922c1c93 100644 (file)
@@ -28,6 +28,7 @@ public class Ajc153Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
   // public void testCFlowXMLAspectLTW_pr149096() { runTest("cflow xml concrete aspect"); }
   // public void testAmbiguousBinding_pr121805() { runTest("ambiguous binding");}
 //  public void testNoIllegalStateExceptionWithGenericInnerAspect_pr156058() { runTest("no IllegalStateException with generic inner aspect"); }
+  public void testAnnotationsCallConstructors_pr158126() { runTest("annotations, call and constructors problem");}
   public void testIllegalStateExceptionGenerics_pr153845() { runTest("IllegalStateException at GenericSignatureParser.java"); }
   public void testNoIllegalStateExceptionFromAsmDelegate_pr153490_1() { runTest("no illegal state exception from AsmDelegate - 1");}
   public void testNoIllegalStateExceptionFromAsmDelegate_pr153490_2() { runTest("no illegal state exception from AsmDelegate - 2");}
index 2beddab0125e876d68096ca364cbe18e6c321556..665c73c0f5ae54e34003c8403700c95fcc5e7894 100644 (file)
@@ -8,6 +8,15 @@
       <compile files="Nothing.java" aspectpath="blob.jar" options="-1.5" outjar="bang.jar"/>
     </ajc-test>
 
+    <ajc-test dir="bugs153/pr158126" title="annotations, call and constructors problem">
+      <compile files="A.java,B.java,MyAnnotation.java,MyAspect.java" options="-1.5 -showWeaveInfo">
+        <message kind="weave" text="Join point 'constructor-call(void B.&lt;init&gt;())' in Type 'A' (A.java:5) advised by before advice from 'MyAspect' (MyAspect.java:3)"/>
+        <message kind="weave" text="Join point 'constructor-call(void B.&lt;init&gt;(int))' in Type 'A' (A.java:10) advised by before advice from 'MyAspect' (MyAspect.java:3)"/>
+        <message kind="weave" text="Join point 'constructor-call(void A.&lt;init&gt;())' in Type 'A' (A.java:14) advised by before advice from 'MyAspect' (MyAspect.java:3)"/>
+        <message kind="weave" text="Join point 'constructor-call(void A.&lt;init&gt;(int))' in Type 'A' (A.java:15) advised by before advice from 'MyAspect' (MyAspect.java:3)"/>      
+      </compile>
+    </ajc-test>
+
     <ajc-test dir="bugs153/pr156058" title="no IllegalStateException with generic inner aspect">
       <compile files="Bug.java" options="-1.5">
         <message kind="warning" line="2" text="advice defined in MyAspect has not been applied [Xlint:adviceDidNotMatch]"/>