aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authorjhugunin <jhugunin>2003-03-05 19:34:28 +0000
committerjhugunin <jhugunin>2003-03-05 19:34:28 +0000
commit769afc68966b6ea101dfebca14c6d67bd426bfa0 (patch)
tree4e1cfe6c2080f1ad958e79fae0364d196bd3f1cb /weaver
parentfc75595cee1292e5e86d741e9301648b74aa3c79 (diff)
downloadaspectj-769afc68966b6ea101dfebca14c6d67bd426bfa0.tar.gz
aspectj-769afc68966b6ea101dfebca14c6d67bd426bfa0.zip
handling kinds more carefully for shadow sigs so that we can check for
matching kinds with SignaturePattern
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelMethod.java11
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelShadow.java2
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelWorld.java24
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java14
4 files changed, 32 insertions, 19 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java b/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java
index 696a5df4d..9d38b2fd4 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelMethod.java
@@ -37,7 +37,8 @@ final class BcelMethod extends ResolvedMember {
BcelMethod(BcelObjectType declaringType, Method method) {
super(
- method.getName().equals("<init>") ? CONSTRUCTOR : METHOD,
+ method.getName().equals("<init>") ? CONSTRUCTOR :
+ (method.getName().equals("<clinit>") ? STATIC_INITIALIZATION : METHOD),
declaringType,
declaringType.isInterface()
? method.getAccessFlags() | Modifier.INTERFACE
@@ -113,4 +114,12 @@ final class BcelMethod extends ResolvedMember {
public AjAttribute.EffectiveSignatureAttribute getEffectiveSignature() {
return effectiveSignature;
}
+
+ public Kind getKind() {
+ if (associatedShadowMunger != null) {
+ return ADVICE;
+ } else {
+ return super.getKind();
+ }
+ }
}
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
index cff8c4fa9..c1417b7a6 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
@@ -538,7 +538,7 @@ public class BcelShadow extends Shadow {
new BcelShadow(
world,
AdviceExecution,
- world.makeMethodSignature(enclosingMethod),
+ world.makeMethodSignature(enclosingMethod, Member.ADVICE),
enclosingMethod,
null);
ShadowRange r = new ShadowRange(body);
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
index 27249e2cf..b683aff61 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
@@ -252,24 +252,28 @@ public class BcelWorld extends World {
fi.getName(cpg),
"(" + fi.getSignature(cpg) + ")" +fi.getSignature(cpg));
}
-
+
public Member makeMethodSignature(LazyMethodGen mg) {
+ return makeMethodSignature(mg, null);
+ }
+
+
+ public Member makeMethodSignature(LazyMethodGen mg, Member.Kind kind) {
ResolvedMember ret = mg.getMemberView();
if (ret == null) {
int mods = mg.getAccessFlags();
if (mg.getEnclosingClass().isInterface()) {
mods |= Modifier.INTERFACE;
}
-
- org.aspectj.weaver.Member.Kind kind;
- if (mg.getName().equals("<init>")) {
- kind = Member.CONSTRUCTOR;
- } else if (mg.getName().equals("<clinit>")) {
- kind = Member.STATIC_INITIALIZATION;
- } else {
- kind = Member.METHOD;
+ if (kind == null) {
+ if (mg.getName().equals("<init>")) {
+ kind = Member.CONSTRUCTOR;
+ } else if (mg.getName().equals("<clinit>")) {
+ kind = Member.STATIC_INITIALIZATION;
+ } else {
+ kind = Member.METHOD;
+ }
}
-
return new ResolvedMember(kind,
TypeX.forName(mg.getClassName()),
mods,
diff --git a/weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java b/weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java
index d07a2bb12..28ffb33dc 100644
--- a/weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java
+++ b/weaver/src/org/aspectj/weaver/patterns/SignaturePattern.java
@@ -93,16 +93,16 @@ public class SignaturePattern extends PatternNode {
world.getLint().unresolvableMember.signal(member.toString(), getSourceLocation());
return false;
}
-
- // AMC test for Kind match surely???
- if (!(sig.getKind() == kind)) return false;
-
-
+
+ // This check should only matter when used from WithincodePointcut as KindedPointcut
+ // has already effectively checked this with the shadows kind.
+ if (kind != member.getKind()) {
+ return false;
+ }
+
if (kind == Member.ADVICE) return true;
if (!modifiers.matches(sig.getModifiers())) return false;
-
-
if (kind == Member.STATIC_INITIALIZATION) {
//System.err.println("match static init: " + sig.getDeclaringType() + " with " + this);