]> source.dussan.org Git - aspectj.git/commitdiff
240360 - test and fix for -proceedOnError and weaving in the face of broken source
authoraclement <aclement>
Thu, 17 Jul 2008 20:08:03 +0000 (20:08 +0000)
committeraclement <aclement>
Thu, 17 Jul 2008 20:08:03 +0000 (20:08 +0000)
tests/multiIncremental/pr240360/base/test/Base.java [new file with mode: 0644]
tests/multiIncremental/pr240360/base/test/Error.java [new file with mode: 0644]
tests/multiIncremental/pr240360/base/test/Sub.java [new file with mode: 0644]
tests/multiIncremental/pr240360/base/test/TestIt.java [new file with mode: 0644]
tests/multiIncremental/pr240360/base/test/aj/ModelAspect.aj [new file with mode: 0644]
tests/multiIncremental/pr240360/inc1/test/Error.java [new file with mode: 0644]
tests/multiIncremental/pr240360/inc2/test/aj/ModelAspect.aj [new file with mode: 0644]
tests/src/org/aspectj/systemtest/ajc161/ajc161.xml
tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java

diff --git a/tests/multiIncremental/pr240360/base/test/Base.java b/tests/multiIncremental/pr240360/base/test/Base.java
new file mode 100644 (file)
index 0000000..fe9a5e6
--- /dev/null
@@ -0,0 +1,28 @@
+package test;
+
+public class Base {
+       private int id;
+       private String value;
+
+       public Base(int id, String value) {
+               super();
+               this.id = id;
+               this.value = value;
+       }
+
+       public int getId() {
+               return id;
+       }
+
+       public void setId(int id) {
+               this.id = id;
+       }
+
+       public String getValue() {
+               return value;
+       }
+
+       public void setValue(String value) {
+               this.value = value;
+       }
+}
diff --git a/tests/multiIncremental/pr240360/base/test/Error.java b/tests/multiIncremental/pr240360/base/test/Error.java
new file mode 100644 (file)
index 0000000..0e01e5e
--- /dev/null
@@ -0,0 +1,5 @@
+package test;
+
+public class Error {
+asdf
+}
diff --git a/tests/multiIncremental/pr240360/base/test/Sub.java b/tests/multiIncremental/pr240360/base/test/Sub.java
new file mode 100644 (file)
index 0000000..342d06e
--- /dev/null
@@ -0,0 +1,33 @@
+package test;
+
+public class Sub extends Base {
+       private int numValue;
+
+       private String description;
+
+       public Sub(int id, String value, String description, int numValue) {
+               super(id, value);
+               this.description = description;
+               this.numValue = numValue;
+       }
+       
+       public int getNumValue() {
+               return numValue;
+       }
+
+       public void setNumValue(int numValue) {
+               this.numValue = numValue;
+       }
+
+       public String getDescription() {
+               return description;
+       }
+
+       public void setDescription(String description) {
+               this.description = description;
+       }
+       
+       public void other() {
+//             blah;
+       }
+}
diff --git a/tests/multiIncremental/pr240360/base/test/TestIt.java b/tests/multiIncremental/pr240360/base/test/TestIt.java
new file mode 100644 (file)
index 0000000..28d4dc7
--- /dev/null
@@ -0,0 +1,10 @@
+package test;
+
+public class TestIt {
+       public static void main(String[] args) {
+               Sub s = new Sub(3, "testValue", "Desc", 17);
+               s.setValue("another value");
+               s.setDescription("blue");
+               System.out.println("done.");
+       }
+}
diff --git a/tests/multiIncremental/pr240360/base/test/aj/ModelAspect.aj b/tests/multiIncremental/pr240360/base/test/aj/ModelAspect.aj
new file mode 100644 (file)
index 0000000..f71995b
--- /dev/null
@@ -0,0 +1,12 @@
+package test.aj;
+
+import test.Base;
+
+
+public aspect ModelAspect {
+         pointcut setter(Base o, Object v): set(* Base+.*) && target(o) && args(v);
+
+         void around(Base o, Object v) : setter(o, v) {
+                 System.out.println(o + ": " +thisJoinPoint.getSignature().getName()+", "+v);
+         }
+}
diff --git a/tests/multiIncremental/pr240360/inc1/test/Error.java b/tests/multiIncremental/pr240360/inc1/test/Error.java
new file mode 100644 (file)
index 0000000..0e01e5e
--- /dev/null
@@ -0,0 +1,5 @@
+package test;
+
+public class Error {
+asdf
+}
diff --git a/tests/multiIncremental/pr240360/inc2/test/aj/ModelAspect.aj b/tests/multiIncremental/pr240360/inc2/test/aj/ModelAspect.aj
new file mode 100644 (file)
index 0000000..130089e
--- /dev/null
@@ -0,0 +1,13 @@
+package test.aj;
+
+import test.Base;
+
+
+public aspect ModelAspect {
+         pointcut setter(Base o, Object v): set(* Base+.*) && target(o) && args(v);
+
+         void around(Base o, Object v) : setter(o, v) {
+System.out.println("Advice changed");
+                 System.out.println(o + ": " +thisJoinPoint.getSignature().getName()+", "+v);
+         }
+}
index b28941e6a77bb4216a4d5d938c1a0ada7b667437..29a3448e0edc1c9bb7d6bd1f3765e811eb10127c 100644 (file)
     </ajc-test>
     
        <ajc-test dir="bugs161/pr102733" title="running broken code">
-       <compile files="Invoker.java C.java" options="">
+       <compile files="Invoker.java C.java" options="-proceedOnError">
          <message kind="error" line="2" text="Syntax error"/>
        </compile>
        <run class="Invoker"/>
     </ajc-test>
     
        <ajc-test dir="bugs161/pr102733" title="running broken code - 2">
-       <compile files="Invoker2.java C2.java" options="">
+       <compile files="Invoker2.java C2.java" options="-proceedOnError">
          <message kind="error" line="5"/>
        </compile>
        <run class="Invoker2"/>
index 317dc6c9a919adb7e1107c98d0a84807c39086fd..aaf74b812ffd55e702937a3a1e2cccb4e2c81695 100644 (file)
@@ -251,9 +251,48 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
                build("P2");
                checkWasntFullBuild();
        }
+
+       public void testBuildingBrokenCode_pr240360() {
+               AjdeInteractionTestbed.VERBOSE=true;
+               initialiseProject("pr240360");
+               //configureNonStandardCompileOptions("pr240360","-proceedOnError");
+               build("pr240360");
+               checkWasFullBuild();
+               checkCompileWeaveCount("pr240360",5,4);
+               assertTrue("There should be an error:\n"
+                               +getErrorMessages("pr240360"),!getErrorMessages("pr240360").isEmpty()); 
+
+               Set s = AsmManager.getDefault().getRelationshipMap().getEntries();
+               int relmapLength = s.size();
+
+               // Delete the erroneous type
+               String f = getWorkingDir().getAbsolutePath() + File.separatorChar + "pr240360" + File.separatorChar + "src" + File.separatorChar + "test" + File.separatorChar + "Error.java";
+               (new File(f)).delete();
+               build("pr240360");
+               checkWasntFullBuild();
+               checkCompileWeaveCount("pr240360",0,0);         
+               assertEquals(relmapLength,AsmManager.getDefault().getRelationshipMap().getEntries().size());
+               
+               // Readd the erroneous type
+               alter("pr240360","inc1");
+               build("pr240360");
+               checkWasntFullBuild();
+               checkCompileWeaveCount("pr240360",1,0);
+               assertEquals(relmapLength,AsmManager.getDefault().getRelationshipMap().getEntries().size());
+
+               // Change the advice
+               alter("pr240360","inc2");
+               build("pr240360");
+               checkWasFullBuild();
+               checkCompileWeaveCount("pr240360",6,4);
+               assertEquals(relmapLength,AsmManager.getDefault().getRelationshipMap().getEntries().size());
+       
+       }
+       
        
        public void testBrokenCodeCompilation() {
                initialiseProject("pr102733_1");
+//             configureNonStandardCompileOptions("pr102733_1","-proceedOnError");
                build("pr102733_1");
                checkWasFullBuild();
                checkCompileWeaveCount("pr102733_1",1,0);
@@ -632,7 +671,7 @@ public class MultiProjectIncrementalTests extends AbstractMultiProjectIncrementa
                        initialiseProject("pr117209");
                        configureNonStandardCompileOptions("pr117209","-proceedOnError");
                        build("pr117209");
-                       checkCompileWeaveCount("pr117209",6,6);
+                       checkCompileWeaveCount("pr117209",6,5);
                } finally {
                        //MyBuildOptionsAdapter.reset();
                }