aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-11-21 17:15:07 +0000
committeracolyer <acolyer>2005-11-21 17:15:07 +0000
commit2d0af56cbcad1de209d5432fca11c02ae8e26566 (patch)
treed1fd5e484f889c9e5a6e955e73f61c62daee65c6 /weaver
parentfa0d385efb794ade2bfd31c2f1e40f1f15927f76 (diff)
downloadaspectj-2d0af56cbcad1de209d5432fca11c02ae8e26566.tar.gz
aspectj-2d0af56cbcad1de209d5432fca11c02ae8e26566.zip
fix for reading in pointcuts with argument binding in reflective world - remember string representation before binding screws it up!
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java11
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java8
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/ArgsPointcut.java6
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java8
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java4
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java10
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java8
-rw-r--r--weaver/src/org/aspectj/weaver/tools/PointcutParser.java4
8 files changed, 44 insertions, 15 deletions
diff --git a/weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java b/weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java
index b6ee8ee08..f01b9240e 100644
--- a/weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java
@@ -65,16 +65,19 @@ public class AnnotationPointcut extends NameBindingPointcut {
private ExactAnnotationTypePattern annotationTypePattern;
private ShadowMunger munger = null; // only set after concretization
+ private String declarationText;
public AnnotationPointcut(ExactAnnotationTypePattern type) {
super();
this.annotationTypePattern = type;
this.pointcutKind = Pointcut.ANNOTATION;
+ buildDeclarationText();
}
public AnnotationPointcut(ExactAnnotationTypePattern type, ShadowMunger munger) {
this(type);
this.munger = munger;
+ buildDeclarationText();
}
public ExactAnnotationTypePattern getAnnotationTypePattern() {
@@ -252,13 +255,17 @@ public class AnnotationPointcut extends NameBindingPointcut {
return result;
}
- public String toString() {
+ public void buildDeclarationText() {
StringBuffer buf = new StringBuffer();
buf.append("@annotation(");
String annPatt = annotationTypePattern.toString();
buf.append(annPatt.startsWith("@") ? annPatt.substring(1) : annPatt);
buf.append(")");
- return buf.toString();
+ this.declarationText = buf.toString();
+ }
+
+ public String toString() {
+ return this.declarationText;
}
public Object accept(PatternNodeVisitor visitor, Object data) {
diff --git a/weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java b/weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java
index f289c585d..2cc2b2cbc 100644
--- a/weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/ArgsAnnotationPointcut.java
@@ -42,6 +42,7 @@ import org.aspectj.weaver.ast.Var;
public class ArgsAnnotationPointcut extends NameBindingPointcut {
private AnnotationPatternList arguments;
+ private String declarationText;
/**
*
@@ -50,6 +51,7 @@ public class ArgsAnnotationPointcut extends NameBindingPointcut {
super();
this.arguments = arguments;
this.pointcutKind = ATARGS;
+ buildDeclarationText();
}
public AnnotationPatternList getArguments() {
@@ -225,11 +227,13 @@ public class ArgsAnnotationPointcut extends NameBindingPointcut {
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
- public String toString() {
+ private void buildDeclarationText() {
StringBuffer buf = new StringBuffer("@args");
buf.append(arguments.toString());
- return buf.toString();
+ this.declarationText = buf.toString();
}
+
+ public String toString() { return this.declarationText; }
public Object accept(PatternNodeVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/weaver/src/org/aspectj/weaver/patterns/ArgsPointcut.java b/weaver/src/org/aspectj/weaver/patterns/ArgsPointcut.java
index 6ddb09e7d..884c7ec90 100644
--- a/weaver/src/org/aspectj/weaver/patterns/ArgsPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/ArgsPointcut.java
@@ -48,10 +48,12 @@ public class ArgsPointcut extends NameBindingPointcut {
private static final String ASPECTJ_SYNTHETIC_SIGNATURE_PREFIX = "Lorg/aspectj/runtime/internal/";
private TypePatternList arguments;
+ private String stringRepresentation;
public ArgsPointcut(TypePatternList arguments) {
this.arguments = arguments;
this.pointcutKind = ARGS;
+ this.stringRepresentation = "args" + arguments.toString() + "";
}
public TypePatternList getArguments() {
@@ -288,9 +290,9 @@ public class ArgsPointcut extends NameBindingPointcut {
}
public String toString() {
- return "args" + arguments.toString() + "";
+ return this.stringRepresentation;
}
-
+
public Object accept(PatternNodeVisitor visitor, Object data) {
return visitor.visit(this, data);
}
diff --git a/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java b/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java
index 54f26a01d..fc9493c5b 100644
--- a/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetAnnotationPointcut.java
@@ -46,6 +46,7 @@ public class ThisOrTargetAnnotationPointcut extends NameBindingPointcut {
private boolean alreadyWarnedAboutDEoW = false;
private ExactAnnotationTypePattern annotationTypePattern;
private ShadowMunger munger;
+ private String declarationText;
private static final Set thisKindSet = new HashSet(Shadow.ALL_SHADOW_KINDS);
private static final Set targetKindSet = new HashSet(Shadow.ALL_SHADOW_KINDS);
static {
@@ -64,6 +65,7 @@ public class ThisOrTargetAnnotationPointcut extends NameBindingPointcut {
this.isThis = isThis;
this.annotationTypePattern = type;
this.pointcutKind = ATTHIS_OR_TARGET;
+ buildDeclarationText();
}
public ThisOrTargetAnnotationPointcut(boolean isThis, ExactAnnotationTypePattern type, ShadowMunger munger) {
@@ -266,14 +268,16 @@ public class ThisOrTargetAnnotationPointcut extends NameBindingPointcut {
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
- public String toString() {
+ private void buildDeclarationText() {
StringBuffer buf = new StringBuffer();
buf.append(isThis ? "@this(" : "@target(");
String annPatt = annotationTypePattern.toString();
buf.append(annPatt.startsWith("@") ? annPatt.substring(1) : annPatt);
buf.append(")");
- return buf.toString();
+ this.declarationText = buf.toString();
}
+
+ public String toString() { return this.declarationText; }
public Object accept(PatternNodeVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java b/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java
index 916fff935..e3f61254e 100644
--- a/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java
@@ -54,6 +54,7 @@ import org.aspectj.weaver.ast.Var;
public class ThisOrTargetPointcut extends NameBindingPointcut {
private boolean isThis;
private TypePattern type;
+ private String declarationText;
private static final Set thisKindSet = new HashSet(Shadow.ALL_SHADOW_KINDS);
private static final Set targetKindSet = new HashSet(Shadow.ALL_SHADOW_KINDS);
@@ -69,6 +70,7 @@ public class ThisOrTargetPointcut extends NameBindingPointcut {
this.isThis = isThis;
this.type = type;
this.pointcutKind = THIS_OR_TARGET;
+ this.declarationText = (isThis ? "this(" : "target(") + type + ")";
}
public TypePattern getType() {
@@ -166,7 +168,7 @@ public class ThisOrTargetPointcut extends NameBindingPointcut {
return result;
}
public String toString() {
- return (isThis ? "this(" : "target(") + type + ")";
+ return declarationText;
}
/**
diff --git a/weaver/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java b/weaver/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java
index c15d35787..e285a5a1a 100644
--- a/weaver/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java
@@ -45,6 +45,7 @@ public class WithinAnnotationPointcut extends NameBindingPointcut {
private AnnotationTypePattern annotationTypePattern;
private ShadowMunger munger;
+ private String declarationText;
/**
*
@@ -53,6 +54,7 @@ public class WithinAnnotationPointcut extends NameBindingPointcut {
super();
this.annotationTypePattern = type;
this.pointcutKind = ATWITHIN;
+ buildDeclarationText();
}
public WithinAnnotationPointcut(AnnotationTypePattern type, ShadowMunger munger) {
@@ -195,13 +197,17 @@ public class WithinAnnotationPointcut extends NameBindingPointcut {
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
- public String toString() {
+ private void buildDeclarationText() {
StringBuffer buf = new StringBuffer();
buf.append("@within(");
String annPatt = annotationTypePattern.toString();
buf.append(annPatt.startsWith("@") ? annPatt.substring(1) : annPatt);
buf.append(")");
- return buf.toString();
+ this.declarationText = buf.toString();
+ }
+
+ public String toString() {
+ return this.declarationText;
}
public Object accept(PatternNodeVisitor visitor, Object data) {
diff --git a/weaver/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java b/weaver/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java
index 0a67b285e..7022d2cee 100644
--- a/weaver/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/WithinCodeAnnotationPointcut.java
@@ -47,6 +47,7 @@ public class WithinCodeAnnotationPointcut extends NameBindingPointcut {
private ExactAnnotationTypePattern annotationTypePattern;
private ShadowMunger munger = null; // only set after concretization
+ private String declarationText;
private static final Set matchedShadowKinds = new HashSet();
static {
matchedShadowKinds.addAll(Shadow.ALL_SHADOW_KINDS);
@@ -60,6 +61,7 @@ public class WithinCodeAnnotationPointcut extends NameBindingPointcut {
super();
this.annotationTypePattern = type;
this.pointcutKind = Pointcut.ATWITHINCODE;
+ buildDeclarationText();
}
public WithinCodeAnnotationPointcut(ExactAnnotationTypePattern type, ShadowMunger munger) {
@@ -202,14 +204,16 @@ public class WithinCodeAnnotationPointcut extends NameBindingPointcut {
return result;
}
- public String toString() {
+ private void buildDeclarationText() {
StringBuffer buf = new StringBuffer();
buf.append("@withincode(");
String annPatt = annotationTypePattern.toString();
buf.append(annPatt.startsWith("@") ? annPatt.substring(1) : annPatt);
buf.append(")");
- return buf.toString();
+ this.declarationText = buf.toString();
}
+
+ public String toString() { return this.declarationText; }
public Object accept(PatternNodeVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/weaver/src/org/aspectj/weaver/tools/PointcutParser.java b/weaver/src/org/aspectj/weaver/tools/PointcutParser.java
index 533f9938f..9b9924974 100644
--- a/weaver/src/org/aspectj/weaver/tools/PointcutParser.java
+++ b/weaver/src/org/aspectj/weaver/tools/PointcutParser.java
@@ -239,13 +239,13 @@ public class PointcutParser {
for (int i = 0; i < formalParameters.length; i++) {
arity.put(i, i);
}
- pc = pc.concretize(declaringTypeForResolution, declaringTypeForResolution, arity);
+ pc = pc.concretize(declaringTypeForResolution, declaringTypeForResolution, arity);
validateAgainstSupportedPrimitives(pc,expression); // again, because we have now followed any ref'd pcuts
pcExpr = new PointcutExpressionImpl(pc,expression,formalParameters,getWorld());
} catch (ParserException pEx) {
throw new IllegalArgumentException(buildUserMessageFromParserException(expression,pEx));
} catch (ReflectionWorld.ReflectionWorldException rwEx) {
- throw new IllegalArgumentException(rwEx.getMessage());
+ throw new IllegalArgumentException(rwEx.getMessage());
}
return pcExpr;
}