aboutsummaryrefslogtreecommitdiffstats
path: root/ajde
diff options
context:
space:
mode:
authormkersten <mkersten>2003-08-06 12:26:34 +0000
committermkersten <mkersten>2003-08-06 12:26:34 +0000
commit1508de05e2a9c9c8e1d2c429e8b5d0415ce0a1a5 (patch)
tree823d0b0baa65f7a5b1a3c0b710372391663817d9 /ajde
parent511b6634ddd4554f30b4104d493ea7244a79d97b (diff)
downloadaspectj-1508de05e2a9c9c8e1d2c429e8b5d0415ce0a1a5.tar.gz
aspectj-1508de05e2a9c9c8e1d2c429e8b5d0415ce0a1a5.zip
Improved generation of advice and pointcut names in the ASM.
Diffstat (limited to 'ajde')
-rw-r--r--ajde/testdata/examples/coverage/ModelCoverage.java5
-rw-r--r--ajde/testdata/examples/coverage/coverage.ajsymbin19080 -> 20658 bytes
-rw-r--r--ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java56
3 files changed, 55 insertions, 6 deletions
diff --git a/ajde/testdata/examples/coverage/ModelCoverage.java b/ajde/testdata/examples/coverage/ModelCoverage.java
index 6fa3255d6..6d09ba59d 100644
--- a/ajde/testdata/examples/coverage/ModelCoverage.java
+++ b/ajde/testdata/examples/coverage/ModelCoverage.java
@@ -65,9 +65,14 @@ aspect AdviceNamingCoverage {
int around(int i) throws SizeException: namedWithOneArg(i) { return proceed(i); }
before(): named() { }
+ before(int i): call(* *.mumble()) && named() && namedWithOneArg(i) { }
+ before(int i): named() && call(* *.mumble()) && namedWithOneArg(i) { }
before(): call(* *.mumble()) { }
+}
+abstract aspect AbstractAspect {
+ abstract pointcut abPtct();
}
aspect InterTypeDecCoverage {
diff --git a/ajde/testdata/examples/coverage/coverage.ajsym b/ajde/testdata/examples/coverage/coverage.ajsym
index 324199378..25bc2b070 100644
--- a/ajde/testdata/examples/coverage/coverage.ajsym
+++ b/ajde/testdata/examples/coverage/coverage.ajsym
Binary files differ
diff --git a/ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java b/ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java
index 4f2a82bbe..81f054f6b 100644
--- a/ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java
+++ b/ajde/testsrc/org/aspectj/ajde/AsmDeclarationsTest.java
@@ -18,6 +18,7 @@ import org.aspectj.asm.*;
import org.aspectj.asm.ProgramElementNode.Kind;
+// TODO: check for return types
public class AsmDeclarationsTest extends AjdeTestCase {
private StructureModel model = null;
@@ -35,12 +36,12 @@ public class AsmDeclarationsTest extends AjdeTestCase {
ProgramElementNode aspect = StructureModelManager.getDefault().getStructureModel().findNodeForClass(null, "InterTypeDecCoverage");
assertNotNull(aspect);
- String decErrMessage = "declare error: Illegal construct..";
+ String decErrMessage = "declare error: \"Illegal construct..\"";
ProgramElementNode decErrNode = model.findNode(aspect, ProgramElementNode.Kind.DECLARE_ERROR, decErrMessage);
assertNotNull(decErrNode);
assertEquals(decErrNode.getName(), decErrMessage);
- String decWarnMessage = "declare warning: Illegal construct..";
+ String decWarnMessage = "declare warning: \"Illegal construct..\"";
ProgramElementNode decWarnNode = model.findNode(aspect, ProgramElementNode.Kind.DECLARE_WARNING, decWarnMessage);
assertNotNull(decWarnNode);
assertEquals(decWarnNode.getName(), decWarnMessage);
@@ -115,6 +116,19 @@ public class AsmDeclarationsTest extends AjdeTestCase {
}
+ public void testAbstract() {
+ ProgramElementNode node = (ProgramElementNode)model.getRoot();
+ assertNotNull(node);
+
+ ProgramElementNode aspect = StructureModelManager.getDefault().getStructureModel().findNodeForClass(null, "AbstractAspect");
+ assertNotNull(aspect);
+
+ String abst = "abPtct()";
+ ProgramElementNode abstNode = model.findNode(aspect, ProgramElementNode.Kind.POINTCUT, abst);
+ assertNotNull(abstNode);
+ assertEquals(abstNode.getName(), abst);
+ }
+
public void testAdvice() {
ProgramElementNode node = (ProgramElementNode)model.getRoot();
assertNotNull(node);
@@ -122,10 +136,40 @@ public class AsmDeclarationsTest extends AjdeTestCase {
ProgramElementNode aspect = StructureModelManager.getDefault().getStructureModel().findNodeForClass(null, "AdviceNamingCoverage");
assertNotNull(aspect);
-// String anon = "<anonymous pointcut>";
-// ProgramElementNode anonNode = model.findNode(aspect, ProgramElementNode.Kind.POINTCUT, anon);
-// assertNotNull(anonNode);
-// assertEquals(anonNode.getName(), anon);
+ String anon = "before(): <anonymous pointcut>";
+ ProgramElementNode anonNode = model.findNode(aspect, ProgramElementNode.Kind.ADVICE, anon);
+ assertNotNull(anonNode);
+ assertEquals(anonNode.getName(), anon);
+
+ String named = "before(): named..";
+ ProgramElementNode namedNode = model.findNode(aspect, ProgramElementNode.Kind.ADVICE, named);
+ assertNotNull(namedNode);
+ assertEquals(namedNode.getName(), named);
+
+ String namedWithOneArg = "around(int): namedWithOneArg..";
+ ProgramElementNode namedWithOneArgNode = model.findNode(aspect, ProgramElementNode.Kind.ADVICE, namedWithOneArg);
+ assertNotNull(namedWithOneArgNode);
+ assertEquals(namedWithOneArgNode.getName(), namedWithOneArg);
+
+ String afterReturning = "afterReturning(int, int): namedWithArgs..";
+ ProgramElementNode afterReturningNode = model.findNode(aspect, ProgramElementNode.Kind.ADVICE, afterReturning);
+ assertNotNull(afterReturningNode);
+ assertEquals(afterReturningNode.getName(), afterReturning);
+
+ String around = "around(int): namedWithOneArg..";
+ ProgramElementNode aroundNode = model.findNode(aspect, ProgramElementNode.Kind.ADVICE, around);
+ assertNotNull(aroundNode);
+ assertEquals(aroundNode.getName(), around);
+
+ String compAnon = "before(int): <anonymous pointcut>..";
+ ProgramElementNode compAnonNode = model.findNode(aspect, ProgramElementNode.Kind.ADVICE, compAnon);
+ assertNotNull(compAnonNode);
+ assertEquals(compAnonNode.getName(), compAnon);
+
+ String compNamed = "before(int): named()..";
+ ProgramElementNode compNamedNode = model.findNode(aspect, ProgramElementNode.Kind.ADVICE, compNamed);
+ assertNotNull(compNamedNode);
+ assertEquals(compNamedNode.getName(), compNamed);
}
protected void setUp() throws Exception {