]> source.dussan.org Git - aspectj.git/commitdiff
276399: test and fix: annotation matching, default package and source folder
authoraclement <aclement>
Fri, 15 May 2009 06:19:20 +0000 (06:19 +0000)
committeraclement <aclement>
Fri, 15 May 2009 06:19:20 +0000 (06:19 +0000)
tests/multiIncremental/pr276399/base/src/C.java [new file with mode: 0644]
tests/multiIncremental/pr276399/base/src/X.aj [new file with mode: 0644]
tests/multiIncremental/pr276399/inc1/src/X.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java

diff --git a/tests/multiIncremental/pr276399/base/src/C.java b/tests/multiIncremental/pr276399/base/src/C.java
new file mode 100644 (file)
index 0000000..9f29511
--- /dev/null
@@ -0,0 +1,12 @@
+//
+//public class C {
+//
+////   public C() {System.out.println("a");    }  
+//     
+//     public C(String s) {}
+//     
+//     public static void main(String[] args) {
+//             new C();
+//     }
+//}
+
diff --git a/tests/multiIncremental/pr276399/base/src/X.aj b/tests/multiIncremental/pr276399/base/src/X.aj
new file mode 100644 (file)
index 0000000..39adcbf
--- /dev/null
@@ -0,0 +1,20 @@
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface WebService {}
+
+@WebService 
+class Foo {
+
+        public Foo() {}
+
+}
+aspect X {
+
+        after(): execution(*.new(..)) && @within(WebService) {
+
+        }
+}
+
+
diff --git a/tests/multiIncremental/pr276399/inc1/src/X.aj b/tests/multiIncremental/pr276399/inc1/src/X.aj
new file mode 100644 (file)
index 0000000..8d53d83
--- /dev/null
@@ -0,0 +1,20 @@
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface WebService {}
+
+//@WebService 
+class Foo {
+
+        public Foo() {}
+
+}
+aspect X {
+
+        after(): execution(*.new(..)) && @within(WebService) {
+
+        }
+}
+
+
index ab18d15fc1dc6db28c4641b08b70a1194a481698..9206b64294bfb82e4eb0fafebc13fb78a97464a7 100644 (file)
@@ -53,8 +53,42 @@ import org.aspectj.util.FileUtil;
  */
 public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementalAjdeInteractionTestbed {
 
+       public void testIncrementalAnnotationMatched_276399() throws Exception {
+               String p = "pr276399";
+               initialiseProject(p);
+               addSourceFolderForSourceFile(p, getProjectRelativePath(p, "src/X.aj"), "src");
+               addSourceFolderForSourceFile(p, getProjectRelativePath(p, "src/C.java"), "src");
+               build(p);
+               printModel(p);
+               IRelationshipMap irm = getModelFor(p).getRelationshipMap();
+               IRelationship ir = (IRelationship) irm.get("=pr276399/src<*X.aj}X&after").get(0);
+               assertNotNull(ir);
+               alter(p, "inc1");
+               build(p);
+               printModel(p);
+               irm = getModelFor(p).getRelationshipMap();
+               List rels = irm.get("=pr276399/src<*X.aj}X&after"); // should be gone after the inc build
+               assertNull(rels);
+       }
+/*
+       public void testIncrementalItdDefaultCtor() {
+               String p = "pr275032";
+               initialiseProject(p);
+               build(p);
+               assertEquals(0, getErrorMessages(p).size());
+               alter(p, "inc1");
+               build(p);
+               // error is: inter-type declaration from X conflicts with existing member: void A.<init>()
+               List ms = getErrorMessages(p);
+               for (Iterator iterator = ms.iterator(); iterator.hasNext();) {
+                       Object object = (Object) iterator.next();
+                       System.out.println(object);
+               }
+               assertEquals(1, getErrorMessages(p).size());
+               assertTrue("Was:" + getErrorMessages(p).get(0), getErrorMessages(p).get(0).toString().indexOf("conflicts") != -1);
+       }
+*/
        public void testOutputLocationCallbacks2() {
-               AjdeInteractionTestbed.VERBOSE = true;
                String p = "pr268827_ol_res";
                initialiseProject(p);
                Map m = new HashMap();