diff options
author | jhugunin <jhugunin> | 2003-03-11 19:06:21 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2003-03-11 19:06:21 +0000 |
commit | bb66774ab4a5afb36d36bc8274ff265f10d666db (patch) | |
tree | 74791661e026330bd526f31b5e1a33b8565309dc /weaver | |
parent | ae0ef30e2a9c8a4ef7ff59219b15b5109c956d22 (diff) | |
download | aspectj-bb66774ab4a5afb36d36bc8274ff265f10d666db.tar.gz aspectj-bb66774ab4a5afb36d36bc8274ff265f10d666db.zip |
further work on binary aspects (aspect path) tested and implemented correct behavior
for obvious forms of abstract aspects now
Diffstat (limited to 'weaver')
5 files changed, 25 insertions, 24 deletions
diff --git a/weaver/src/org/aspectj/weaver/ConcreteTypeMunger.java b/weaver/src/org/aspectj/weaver/ConcreteTypeMunger.java index 7eda16abb..d268f2fba 100644 --- a/weaver/src/org/aspectj/weaver/ConcreteTypeMunger.java +++ b/weaver/src/org/aspectj/weaver/ConcreteTypeMunger.java @@ -49,7 +49,7 @@ public abstract class ConcreteTypeMunger implements PartialOrder.PartialComparab public boolean matches(ResolvedTypeX onType) { if (munger == null) throw new RuntimeException("huh: " + this); - return munger.matches(onType); + return munger.matches(onType, aspectType); } public ResolvedMember getMatchingSyntheticMember(Member member) { diff --git a/weaver/src/org/aspectj/weaver/PerObjectInterfaceTypeMunger.java b/weaver/src/org/aspectj/weaver/PerObjectInterfaceTypeMunger.java index 1064d7e83..504f03001 100644 --- a/weaver/src/org/aspectj/weaver/PerObjectInterfaceTypeMunger.java +++ b/weaver/src/org/aspectj/weaver/PerObjectInterfaceTypeMunger.java @@ -59,7 +59,7 @@ public class PerObjectInterfaceTypeMunger extends ResolvedTypeMunger { return testPointcut; } - public boolean matches(ResolvedTypeX matchType) { + public boolean matches(ResolvedTypeX matchType, ResolvedTypeX aspectType) { //??? this matches many more types than are needed return !matchType.isInterface(); } diff --git a/weaver/src/org/aspectj/weaver/ResolvedTypeMunger.java b/weaver/src/org/aspectj/weaver/ResolvedTypeMunger.java index b2365c388..8944e788f 100644 --- a/weaver/src/org/aspectj/weaver/ResolvedTypeMunger.java +++ b/weaver/src/org/aspectj/weaver/ResolvedTypeMunger.java @@ -49,14 +49,17 @@ public abstract class ResolvedTypeMunger { } - public boolean matches(ResolvedTypeX matchType) { + public boolean matches(ResolvedTypeX matchType, ResolvedTypeX aspectType) { ResolvedTypeX onType = matchType.getWorld().resolve(signature.getDeclaringType()); //System.err.println("matching: " + this + " to " + matchType + " onType = " + onType); if (matchType.equals(onType)) { - if (!onType.isExposedToWeaver() && - matchType.getWorld().getLint().typeNotExposedToWeaver.isEnabled()) - { - matchType.getWorld().getLint().typeNotExposedToWeaver.signal(matchType.getName(), signature.getSourceLocation()); + if (!onType.isExposedToWeaver()) { + if (!onType.isWovenBy(aspectType)) { + if (matchType.getWorld().getLint().typeNotExposedToWeaver.isEnabled()) { + matchType.getWorld().getLint().typeNotExposedToWeaver.signal( + matchType.getName(), signature.getSourceLocation()); + } + } } return true; } diff --git a/weaver/src/org/aspectj/weaver/ResolvedTypeX.java b/weaver/src/org/aspectj/weaver/ResolvedTypeX.java index 2d7183881..6249a9b21 100644 --- a/weaver/src/org/aspectj/weaver/ResolvedTypeX.java +++ b/weaver/src/org/aspectj/weaver/ResolvedTypeX.java @@ -564,6 +564,10 @@ public abstract class ResolvedTypeX extends TypeX { public boolean isExposedToWeaver() { return delegate.isExposedToWeaver(); //??? where does this belong } + + public boolean isWovenBy(ResolvedTypeX aspectType) { + return delegate.isWovenBy(aspectType); + } public ResolvedMember[] getDeclaredFields() { return delegate.getDeclaredFields(); @@ -646,6 +650,7 @@ public abstract class ResolvedTypeX extends TypeX { public abstract ISourceLocation getSourceLocation(); + public abstract boolean isWovenBy(ResolvedTypeX aspectType); public ISourceContext getSourceContext() { return sourceContext; @@ -1213,4 +1218,8 @@ public abstract class ResolvedTypeX extends TypeX { public ISourceLocation getSourceLocation() { return null; } public boolean isExposedToWeaver() { return false; } + public boolean isWovenBy(ResolvedTypeX aspectType) { + return false; + } + } diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java index d26e63a38..05d7248b1 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelObjectType.java @@ -146,8 +146,6 @@ public class BcelObjectType extends ResolvedTypeX.ConcreteName { ret[len] = d; pointcuts = ret; } - - public boolean isAspect() { return perClause != null; @@ -191,11 +189,6 @@ public class BcelObjectType extends ResolvedTypeX.ConcreteName { return perClause; } - - - - - JavaClass getJavaClass() { return javaClass; } @@ -213,16 +206,12 @@ public class BcelObjectType extends ResolvedTypeX.ConcreteName { isObject = (javaClass.getSuperclassNameIndex() == 0); unpackAspectAttributes(); } - - - /** - * Switch to a new JavaClass and clear all caches - */ - void replaceJavaClass(JavaClass jc) { - if (this.javaClass == jc) return; - - this.javaClass = jc; - resetState(); + + //XXX we've lost information so that we don't know who wove into this + // class, only that someone did. For better error messages we should + // probably expand the information in weaverState + public boolean isWovenBy(ResolvedTypeX aspectType) { + return weaverState == WeaverStateKind.Woven; } public WeaverStateKind getWeaverState() { |