summaryrefslogtreecommitdiffstats
path: root/weaver/src
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-09-29 15:42:52 +0000
committeracolyer <acolyer>2005-09-29 15:42:52 +0000
commit81a07900d1e2c4db563d5b4a833b404ac51ee5bd (patch)
treeaa4901f0d6704d7b2464b439d27f1b4554555e86 /weaver/src
parent5fdb986e1843518b4766c21b1be3b85af780731c (diff)
downloadaspectj-81a07900d1e2c4db563d5b4a833b404ac51ee5bd.tar.gz
aspectj-81a07900d1e2c4db563d5b4a833b404ac51ee5bd.zip
tests and fix for enh 108118, completes @SuppressAjWarnings implementation
Diffstat (limited to 'weaver/src')
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java41
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/Utility.java3
2 files changed, 34 insertions, 10 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java b/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java
index 4b08cd5d6..0c119c09e 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelAdvice.java
@@ -33,6 +33,7 @@ import org.aspectj.weaver.Member;
import org.aspectj.weaver.ResolvedMember;
import org.aspectj.weaver.ResolvedType;
import org.aspectj.weaver.Shadow;
+import org.aspectj.weaver.ShadowMunger;
import org.aspectj.weaver.UnresolvedType;
import org.aspectj.weaver.WeaverMessages;
import org.aspectj.weaver.World;
@@ -40,6 +41,7 @@ import org.aspectj.weaver.ast.Literal;
import org.aspectj.weaver.ast.Test;
import org.aspectj.weaver.patterns.ExactTypePattern;
import org.aspectj.weaver.patterns.ExposedState;
+import org.aspectj.weaver.patterns.PerClause;
import org.aspectj.weaver.patterns.Pointcut;
/**
@@ -76,6 +78,20 @@ public class BcelAdvice extends Advice {
// ---- implementations of ShadowMunger's methods
+ public ShadowMunger concretize(ResolvedType fromType, World world, PerClause clause) {
+ suppressLintWarnings(world);
+ ShadowMunger ret = super.concretize(fromType, world, clause);
+ clearLintSuppressions(world);
+ return ret;
+ }
+
+ public boolean match(Shadow shadow, World world) {
+ suppressLintWarnings(world);
+ boolean ret = super.match(shadow, world);
+ clearLintSuppressions(world);
+ return ret;
+ }
+
public void specializeOn(Shadow shadow) {
if (getKind() == AdviceKind.Around) {
((BcelShadow)shadow).initializeForAroundClosure();
@@ -98,16 +114,9 @@ public class BcelAdvice extends Advice {
}
World world = shadow.getIWorld();
- if (suppressedLintKinds == null) {
- if (signature instanceof BcelMethod) {
- this.suppressedLintKinds = Utility.getSuppressedWarnings(signature.getAnnotations(), world.getLint());
- } else {
- this.suppressedLintKinds = Collections.EMPTY_LIST;
- }
- }
- world.getLint().suppressKinds(suppressedLintKinds);
+ suppressLintWarnings(world);
pointcutTest = getPointcut().findResidue(shadow, exposedState);
- world.getLint().clearSuppressions();
+ clearLintSuppressions(world);
// these initializations won't be performed by findResidue, but need to be
// so that the joinpoint is primed for weaving
@@ -566,4 +575,18 @@ public class BcelAdvice extends Advice {
return hasMatchedAtLeastOnce;
}
+ protected void suppressLintWarnings(World inWorld) {
+ if (suppressedLintKinds == null) {
+ if (signature instanceof BcelMethod) {
+ this.suppressedLintKinds = Utility.getSuppressedWarnings(signature.getAnnotations(), inWorld.getLint());
+ } else {
+ this.suppressedLintKinds = Collections.EMPTY_LIST;
+ }
+ }
+ inWorld.getLint().suppressKinds(suppressedLintKinds);
+ }
+
+ protected void clearLintSuppressions(World inWorld) {
+ inWorld.getLint().clearSuppressions();
+ }
}
diff --git a/weaver/src/org/aspectj/weaver/bcel/Utility.java b/weaver/src/org/aspectj/weaver/bcel/Utility.java
index ebc3cc863..3e6af17a9 100644
--- a/weaver/src/org/aspectj/weaver/bcel/Utility.java
+++ b/weaver/src/org/aspectj/weaver/bcel/Utility.java
@@ -734,7 +734,8 @@ public class Utility {
for (int j = 0; j < values.length; j++) {
// We know values in the array are strings
SimpleElementValue value = (SimpleElementValue)values[j];
- suppressedWarnings.add(lint.getLintKind(value.getValueString()));
+ Lint.Kind lintKind = lint.getLintKind(value.getValueString());
+ if (lintKind != null) suppressedWarnings.add(lintKind);
}
}
}