summaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authoraclement <aclement>2006-10-06 16:29:03 +0000
committeraclement <aclement>2006-10-06 16:29:03 +0000
commitd532892d89865511ea39286e4ebd34fc20b96a5d (patch)
tree6c6eeb9ba24b7afe1686603984763a729bc7b32a /weaver
parent2883a55829716132efcf288acec08bf3ab6826a7 (diff)
downloadaspectj-d532892d89865511ea39286e4ebd34fc20b96a5d.tar.gz
aspectj-d532892d89865511ea39286e4ebd34fc20b96a5d.zip
tests and fixes for jdtlikehandleprovider, bug 159896
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/ShadowMunger.java64
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/DeclareErrorOrWarning.java14
2 files changed, 63 insertions, 15 deletions
diff --git a/weaver/src/org/aspectj/weaver/ShadowMunger.java b/weaver/src/org/aspectj/weaver/ShadowMunger.java
index a4ac3f8e1..a376187a6 100644
--- a/weaver/src/org/aspectj/weaver/ShadowMunger.java
+++ b/weaver/src/org/aspectj/weaver/ShadowMunger.java
@@ -273,31 +273,65 @@ public abstract class ShadowMunger implements PartialOrder.PartialComparable, IH
}
private void addChildNodes(IProgramElement parent, Collection children) {
+ int afterCtr = 1;
+ int aroundCtr = 1;
+ int beforeCtr = 1;
+ int deCtr = 1;
+ int dwCtr = 1;
for (Iterator iter = children.iterator(); iter.hasNext();) {
Object element = (Object) iter.next();
if (element instanceof DeclareErrorOrWarning) {
DeclareErrorOrWarning decl = (DeclareErrorOrWarning)element;
- IProgramElement deowNode = new ProgramElement(
- decl.isError() ? "declare error" : "declare warning",
- decl.isError() ? IProgramElement.Kind.DECLARE_ERROR : IProgramElement.Kind.DECLARE_WARNING,
- getBinarySourceLocation(decl.getSourceLocation()),
- decl.getDeclaringType().getModifiers(),
- null,null);
- deowNode.setDetails("\"" + AsmRelationshipUtils.genDeclareMessage(decl.getMessage()) + "\"");
- parent.addChild(deowNode);
+ int counter = 0;
+ if (decl.isError()) {
+ counter = deCtr++;
+ } else {
+ counter = dwCtr++;
+ }
+ parent.addChild(createDeclareErrorOrWarningChild(decl,counter));
} else if (element instanceof BcelAdvice) {
BcelAdvice advice = (BcelAdvice)element;
- IProgramElement adviceNode = new ProgramElement(
- advice.kind.getName(),
- IProgramElement.Kind.ADVICE,
- getBinarySourceLocation(advice.getSourceLocation()),
- advice.signature.getModifiers(),null,Collections.EMPTY_LIST);
- adviceNode.setDetails(AsmRelationshipUtils.genPointcutDetails(advice.getPointcut()));
- parent.addChild(adviceNode);
+ int counter = 0;
+ if (advice.getKind().equals(AdviceKind.Before)) {
+ counter = beforeCtr++;
+ } else if (advice.getKind().equals(AdviceKind.Around)){
+ counter = aroundCtr++;
+ } else {
+ counter = afterCtr++;
+ }
+ parent.addChild(createAdviceChild(advice,counter));
}
}
}
+ private IProgramElement createDeclareErrorOrWarningChild(
+ DeclareErrorOrWarning decl, int count) {
+ IProgramElement deowNode = new ProgramElement(
+ decl.getName(),
+ decl.isError() ? IProgramElement.Kind.DECLARE_ERROR : IProgramElement.Kind.DECLARE_WARNING,
+ getBinarySourceLocation(decl.getSourceLocation()),
+ decl.getDeclaringType().getModifiers(),
+ null,null);
+ deowNode.setDetails("\"" + AsmRelationshipUtils.genDeclareMessage(decl.getMessage()) + "\"");
+ if (count != -1) {
+ deowNode.setBytecodeName(decl.getName() + "_" + count);
+ }
+ return deowNode;
+ }
+
+ private IProgramElement createAdviceChild(BcelAdvice advice, int counter ) {
+ IProgramElement adviceNode = new ProgramElement(
+ advice.kind.getName(),
+ IProgramElement.Kind.ADVICE,
+ getBinarySourceLocation(advice.getSourceLocation()),
+ advice.signature.getModifiers(),null,Collections.EMPTY_LIST);
+ adviceNode.setDetails(AsmRelationshipUtils.genPointcutDetails(advice.getPointcut()));
+ if (counter != 1) {
+ adviceNode.setBytecodeName(advice.getKind().getName() + "$" + counter + "$");
+ }
+ return adviceNode;
+ }
+
/**
* Returns the binarySourceLocation for the given sourcelocation. This
* isn't cached because it's used when faulting in the binary nodes
diff --git a/weaver/src/org/aspectj/weaver/patterns/DeclareErrorOrWarning.java b/weaver/src/org/aspectj/weaver/patterns/DeclareErrorOrWarning.java
index c4a3948ba..c9b663728 100644
--- a/weaver/src/org/aspectj/weaver/patterns/DeclareErrorOrWarning.java
+++ b/weaver/src/org/aspectj/weaver/patterns/DeclareErrorOrWarning.java
@@ -31,6 +31,9 @@ public class DeclareErrorOrWarning extends Declare {
this.message = message;
}
+ /**
+ * returns "declare warning: <message>" or "declare error: <message>"
+ */
public String toString() {
StringBuffer buf = new StringBuffer();
buf.append("declare ");
@@ -111,4 +114,15 @@ public class DeclareErrorOrWarning extends Declare {
public String getNameSuffix() {
return "eow";
}
+
+ /**
+ * returns "declare warning" or "declare error"
+ */
+ public String getName() {
+ StringBuffer buf = new StringBuffer();
+ buf.append("declare ");
+ if (isError) buf.append("error");
+ else buf.append("warning");
+ return buf.toString();
+ }
}