diff options
author | aclement <aclement> | 2005-02-17 15:11:38 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-02-17 15:11:38 +0000 |
commit | 75207c8bdc8cc4322edb4ae76e804d6a684787ca (patch) | |
tree | 1def53ff551c311f0cf0e59ac731e07a89a6871b /weaver | |
parent | 961da2a081517628ac605693c55ef844e91de29d (diff) | |
download | aspectj-75207c8bdc8cc4322edb4ae76e804d6a684787ca.tar.gz aspectj-75207c8bdc8cc4322edb4ae76e804d6a684787ca.zip |
Deal with putting out the non-matching advice lint warning
Diffstat (limited to 'weaver')
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java index c466d46eb..1c2f7f443 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelWeaver.java @@ -44,6 +44,7 @@ import java.util.zip.ZipOutputStream; import org.aspectj.apache.bcel.classfile.ClassParser; import org.aspectj.apache.bcel.classfile.JavaClass; +import org.aspectj.apache.bcel.classfile.annotation.Annotation; import org.aspectj.bridge.IMessage; import org.aspectj.bridge.IProgressListener; import org.aspectj.bridge.Message; @@ -888,8 +889,28 @@ public class BcelWeaver implements IWeaver { addedClasses = new ArrayList(); deletedTypenames = new ArrayList(); - requestor.weaveCompleted(); + + // if a piece of advice hasn't matched anywhere and we are in -1.5 mode, put out a warning + if (world.behaveInJava5Way && + world.getLint().adviceDidNotMatch.isEnabled()) { + List l = world.getCrosscuttingMembersSet().getShadowMungers(); + for (Iterator iter = l.iterator(); iter.hasNext();) { + ShadowMunger element = (ShadowMunger) iter.next(); + if (element instanceof BcelAdvice) { // This will stop us incorrectly reporting deow Checkers + BcelAdvice ba = (BcelAdvice)element; + if (!ba.hasMatchedSomething()) { + Annotation[] anns = ((BcelMethod)ba.getSignature()).getAnnotations(); + // Check if they want to suppress the warning on this piece of advice + if (!Utility.isSuppressing(anns,"adviceDidNotMatch")) { + world.getLint().adviceDidNotMatch.signal(ba.getDeclaringAspect().getNameAsIdentifier(),element.getSourceLocation()); + } + } + } + } + } + + requestor.weaveCompleted(); return wovenClassNames; } |