summaryrefslogtreecommitdiffstats
path: root/ajde
diff options
context:
space:
mode:
Diffstat (limited to 'ajde')
-rw-r--r--ajde/testdata/WeaveInfoMessagesTest/AspectDeclareAnnotations.aj25
-rw-r--r--ajde/testdata/WeaveInfoMessagesTest/Seven.lst2
-rw-r--r--ajde/testdata/WeaveInfoMessagesTest/Six.lst3
-rw-r--r--ajde/testdata/WeaveInfoMessagesTest/expected/declare.annotation.txt4
-rw-r--r--ajde/testdata/WeaveInfoMessagesTest/expected/declare.annotationNoWeaveInfo.txt0
-rw-r--r--ajde/testsrc/org/aspectj/ajde/ShowWeaveMessagesTestCase.java26
6 files changed, 58 insertions, 2 deletions
diff --git a/ajde/testdata/WeaveInfoMessagesTest/AspectDeclareAnnotations.aj b/ajde/testdata/WeaveInfoMessagesTest/AspectDeclareAnnotations.aj
new file mode 100644
index 000000000..46bda48f8
--- /dev/null
+++ b/ajde/testdata/WeaveInfoMessagesTest/AspectDeclareAnnotations.aj
@@ -0,0 +1,25 @@
+// little aspect and class for testing declaration of annotations
+
+@interface anInterface {}
+
+public aspect AspectDeclareAnnotations{
+
+ declare @type : Test : @anInterface;
+ declare @constructor : Test.new(String,int) : @anInterface;
+ declare @method : int Test.fac(int) : @anInterface;
+ declare @field : int Test.a : @anInterface;
+
+}
+
+class Test{
+
+ public Test(String say, int something){
+ System.out.println(say + something);
+ }
+
+ public int fac(int n){
+ return (n == 0)? 1 : n * fac(n-1);
+ }
+
+ public int a = 1;
+}
diff --git a/ajde/testdata/WeaveInfoMessagesTest/Seven.lst b/ajde/testdata/WeaveInfoMessagesTest/Seven.lst
new file mode 100644
index 000000000..b75e472ad
--- /dev/null
+++ b/ajde/testdata/WeaveInfoMessagesTest/Seven.lst
@@ -0,0 +1,2 @@
+-1.5
+AspectDeclareAnnotations.aj
diff --git a/ajde/testdata/WeaveInfoMessagesTest/Six.lst b/ajde/testdata/WeaveInfoMessagesTest/Six.lst
new file mode 100644
index 000000000..51eaf0703
--- /dev/null
+++ b/ajde/testdata/WeaveInfoMessagesTest/Six.lst
@@ -0,0 +1,3 @@
+-showWeaveInfo
+-1.5
+AspectDeclareAnnotations.aj
diff --git a/ajde/testdata/WeaveInfoMessagesTest/expected/declare.annotation.txt b/ajde/testdata/WeaveInfoMessagesTest/expected/declare.annotation.txt
new file mode 100644
index 000000000..7daacb75d
--- /dev/null
+++ b/ajde/testdata/WeaveInfoMessagesTest/expected/declare.annotation.txt
@@ -0,0 +1,4 @@
+'Test' (AspectDeclareAnnotations.aj:14) is annotated with @anInterface type annotation from 'AspectDeclareAnnotations' (AspectDeclareAnnotations.aj:7)
+'public void Test.new(String,int)' (AspectDeclareAnnotations.aj:16) is annotated with @anInterface constructor annotation from 'AspectDeclareAnnotations' (AspectDeclareAnnotations.aj:8)
+'public int Test.fac(int)' (AspectDeclareAnnotations.aj:20) is annotated with @anInterface method annotation from 'AspectDeclareAnnotations' (AspectDeclareAnnotations.aj:9)
+'public int a' of type 'Test' (AspectDeclareAnnotations.aj) is annotated with @anInterface field annotation from 'AspectDeclareAnnotations' (AspectDeclareAnnotations.aj:10)
diff --git a/ajde/testdata/WeaveInfoMessagesTest/expected/declare.annotationNoWeaveInfo.txt b/ajde/testdata/WeaveInfoMessagesTest/expected/declare.annotationNoWeaveInfo.txt
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/ajde/testdata/WeaveInfoMessagesTest/expected/declare.annotationNoWeaveInfo.txt
diff --git a/ajde/testsrc/org/aspectj/ajde/ShowWeaveMessagesTestCase.java b/ajde/testsrc/org/aspectj/ajde/ShowWeaveMessagesTestCase.java
index e8da5e1ad..a4add872f 100644
--- a/ajde/testsrc/org/aspectj/ajde/ShowWeaveMessagesTestCase.java
+++ b/ajde/testsrc/org/aspectj/ajde/ShowWeaveMessagesTestCase.java
@@ -95,8 +95,7 @@ public class ShowWeaveMessagesTestCase extends AjdeTestCase {
if (rogueSymFile.exists()) rogueSymFile.delete();
}
-
-
+
/**
* Weave all the possible kinds of advice and verify the messages that come out.
@@ -158,6 +157,28 @@ public class ShowWeaveMessagesTestCase extends AjdeTestCase {
verifyWeavingMessages("declare.soft",true);
}
+ /**
+ * Weave 'declare @type, @constructor, @method and @field' and check the weave messages that come out.
+ */
+ public void testWeaveMessagesDeclareAnnotation() {
+ if (debugTests) System.out.println("\ntestWeaveMessagesDeclareAnnotation: Building with Six.lst");
+ compilerAdapter = new CompilerAdapter();
+ compilerAdapter.showInfoMessages(true);
+ compilerAdapter.compile((String) openFile("Six.lst").getAbsolutePath(),new BPM(),false);
+ verifyWeavingMessages("declare.annotation",true);
+ }
+
+ /**
+ * Weave 'declare @type, @constructor, @method and @field' and check the weave messages don't come out without the -showWeaveInfo arg.
+ */
+ public void testWeaveMessagesDeclareAnnotationWeaveInfoOff() {
+ if (debugTests) System.out.println("\ntestWeaveMessagesDeclareAnnotation: Building with Seven.lst");
+ compilerAdapter = new CompilerAdapter();
+ compilerAdapter.showInfoMessages(true);
+ compilerAdapter.compile((String) openFile("Seven.lst").getAbsolutePath(),new BPM(),false);
+ verifyWeavingMessages("declare.annotationNoWeaveInfo",true);
+ }
+
// BINARY WEAVING TESTS
@@ -328,6 +349,7 @@ public class ShowWeaveMessagesTestCase extends AjdeTestCase {
List l = ideManager.getCompilationSourceLineTasks();
for (Iterator iter = l.iterator(); iter.hasNext();) {
IMessage msg = ((NullIdeTaskListManager.SourceLineTask) iter.next()).message;
+ if (debugTests) System.out.println("Looking at ["+msg+"]");
if (msg.getKind().equals(IMessage.WEAVEINFO)) {
if (!fileContents.contains(msg.getMessage())) {
fail("Could not find message '"+msg.getMessage()+"' in the expected results\n"+