From: aclement Date: Tue, 21 Feb 2006 09:25:09 +0000 (+0000) Subject: testcode for 128655 X-Git-Tag: POST_MEMORY_CHANGES~62 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=67a3319816f88e64f933f1ab3d87f02ca446bc15;p=aspectj.git testcode for 128655 --- diff --git a/tests/multiIncremental/pr128655/A.java b/tests/multiIncremental/pr128655/A.java new file mode 100644 index 000000000..e1728b7a5 --- /dev/null +++ b/tests/multiIncremental/pr128655/A.java @@ -0,0 +1,5 @@ + + +public aspect A { + declare @type: T: @Foo; +} diff --git a/tests/multiIncremental/pr128655/Foo.java b/tests/multiIncremental/pr128655/Foo.java new file mode 100644 index 000000000..bf1c2cea6 --- /dev/null +++ b/tests/multiIncremental/pr128655/Foo.java @@ -0,0 +1,6 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +public @interface Foo { + +} diff --git a/tests/multiIncremental/pr128655/T.java b/tests/multiIncremental/pr128655/T.java new file mode 100644 index 000000000..9f5e91e38 --- /dev/null +++ b/tests/multiIncremental/pr128655/T.java @@ -0,0 +1,4 @@ + +public class T { + +} diff --git a/tests/multiIncremental/pr128655/base/A.java b/tests/multiIncremental/pr128655/base/A.java new file mode 100644 index 000000000..3fe24bfcf --- /dev/null +++ b/tests/multiIncremental/pr128655/base/A.java @@ -0,0 +1,4 @@ + +public aspect A { + declare @type: T: @a.b.c.Foo; +} diff --git a/tests/multiIncremental/pr128655/base/Foo.java b/tests/multiIncremental/pr128655/base/Foo.java new file mode 100644 index 000000000..3e46852c7 --- /dev/null +++ b/tests/multiIncremental/pr128655/base/Foo.java @@ -0,0 +1,7 @@ +package a.b.c; +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +public @interface Foo { + +} diff --git a/tests/multiIncremental/pr128655/base/T.java b/tests/multiIncremental/pr128655/base/T.java new file mode 100644 index 000000000..9f5e91e38 --- /dev/null +++ b/tests/multiIncremental/pr128655/base/T.java @@ -0,0 +1,4 @@ + +public class T { + +} diff --git a/tests/multiIncremental/pr128655/inc1/T.java b/tests/multiIncremental/pr128655/inc1/T.java new file mode 100644 index 000000000..9f5e91e38 --- /dev/null +++ b/tests/multiIncremental/pr128655/inc1/T.java @@ -0,0 +1,4 @@ + +public class T { + +} diff --git a/tests/multiIncremental/pr128655_2/base/A.java b/tests/multiIncremental/pr128655_2/base/A.java new file mode 100644 index 000000000..90c4b4de3 --- /dev/null +++ b/tests/multiIncremental/pr128655_2/base/A.java @@ -0,0 +1,4 @@ + +public aspect A { + declare @type: T: @Foo; +} diff --git a/tests/multiIncremental/pr128655_2/base/Foo.java b/tests/multiIncremental/pr128655_2/base/Foo.java new file mode 100644 index 000000000..bf1c2cea6 --- /dev/null +++ b/tests/multiIncremental/pr128655_2/base/Foo.java @@ -0,0 +1,6 @@ +import java.lang.annotation.*; + +@Retention(RetentionPolicy.RUNTIME) +public @interface Foo { + +} diff --git a/tests/multiIncremental/pr128655_2/base/T.java b/tests/multiIncremental/pr128655_2/base/T.java new file mode 100644 index 000000000..9f5e91e38 --- /dev/null +++ b/tests/multiIncremental/pr128655_2/base/T.java @@ -0,0 +1,4 @@ + +public class T { + +} diff --git a/tests/multiIncremental/pr128655_2/inc1/T.java b/tests/multiIncremental/pr128655_2/inc1/T.java new file mode 100644 index 000000000..9f5e91e38 --- /dev/null +++ b/tests/multiIncremental/pr128655_2/inc1/T.java @@ -0,0 +1,4 @@ + +public class T { + +} diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java index 3af1d2fb2..e8f0e4d08 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/AjdeInteractionTestbed.java @@ -626,12 +626,14 @@ public class AjdeInteractionTestbed extends TestCase { private boolean receivedBatchBuildMessage = false; private List errorMessages = new ArrayList(); private List warningMessages = new ArrayList(); + private List weavingMessages = new ArrayList(); public static void reset() { _instance.receivedNonIncrementalBuildMessage=false; _instance.receivedBatchBuildMessage=false; _instance.errorMessages.clear(); _instance.warningMessages.clear(); + _instance.weavingMessages.clear(); } // public static boolean defaultedToBatch() { @@ -654,6 +656,10 @@ public class AjdeInteractionTestbed extends TestCase { return _instance.warningMessages; } + public static List/*IMessage*/ getWeavingMessages() { + return _instance.weavingMessages; + } + public static TaskListManager getInstance() { return _instance; } @@ -668,12 +674,9 @@ public class AjdeInteractionTestbed extends TestCase { // if (message.getMessage().startsWith(CANT_BUILD_INCREMENTAL_INDICATION)) _instance.receivedNonIncrementalBuildMessage=true; // if (message.getMessage().startsWith(DOING_BATCH_BUILD_INDICATION)) _instance.receivedBatchBuildMessage=true; // } - if (message.getKind()==IMessage.ERROR) { - errorMessages.add(message); - } - if (message.getKind()==IMessage.WARNING) { - warningMessages.add(message); - } + if (message.getKind()==IMessage.ERROR) errorMessages.add(message); + if (message.getKind()==IMessage.WARNING) warningMessages.add(message); + if (message.getKind()==IMessage.WEAVEINFO) weavingMessages.add(message); log("TaskListManager.addSourcelineTask("+message+")"); } diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java index 0623ee58a..7a13abed5 100644 --- a/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java +++ b/tests/src/org/aspectj/systemtest/incremental/tools/MultiProjectIncrementalTests.java @@ -515,7 +515,7 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed { } public void testPr112736() { - AjdeInteractionTestbed.VERBOSE = true; + // AjdeInteractionTestbed.VERBOSE = true; initialiseProject("PR112736"); build("PR112736"); checkWasFullBuild(); @@ -547,6 +547,52 @@ public class MultiProjectIncrementalTests extends AjdeInteractionTestbed { checkWasFullBuild(); // back to the source } + + public void testPr128655() { + configureNonStandardCompileOptions("-showWeaveInfo"); + initialiseProject("pr128655"); + build("pr128655"); + List firstBuildMessages = MyTaskListManager.getWeavingMessages(); + assertTrue("Should be at least one message about the dec @type, but there were none",firstBuildMessages.size()>0); + alter("pr128655","inc1"); + build("pr128655"); + checkWasntFullBuild(); // back to the source + List secondBuildMessages = MyTaskListManager.getWeavingMessages(); + // check they are the same + for (int i = 0; i < firstBuildMessages.size(); i++) { + IMessage m1 = (IMessage)firstBuildMessages.get(i); + IMessage m2 = (IMessage)secondBuildMessages.get(i); + if (!m1.toString().equals(m2.toString())) { + System.err.println("Message during first build was: "+m1); + System.err.println("Message during second build was: "+m1); + fail("The two messages should be the same, but are not: \n"+m1+"!="+m2); + } + } + } + + // Similar to above, but now the annotation is in the default package + public void testPr128655_2() { + configureNonStandardCompileOptions("-showWeaveInfo"); + initialiseProject("pr128655_2"); + build("pr128655_2"); + List firstBuildMessages = MyTaskListManager.getWeavingMessages(); + assertTrue("Should be at least one message about the dec @type, but there were none",firstBuildMessages.size()>0); + alter("pr128655_2","inc1"); + build("pr128655_2"); + checkWasntFullBuild(); // back to the source + List secondBuildMessages = MyTaskListManager.getWeavingMessages(); + // check they are the same + for (int i = 0; i < firstBuildMessages.size(); i++) { + IMessage m1 = (IMessage)firstBuildMessages.get(i); + IMessage m2 = (IMessage)secondBuildMessages.get(i); + if (!m1.toString().equals(m2.toString())) { + System.err.println("Message during first build was: "+m1); + System.err.println("Message during second build was: "+m1); + fail("The two messages should be the same, but are not: \n"+m1+"!="+m2); + } + } + } + // other possible tests: // - memory usage (freemem calls?) // - relationship map