From 88c762e2edb06cc7878bae1a86e1b7df3c34fe03 Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 22 Mar 2010 23:02:59 +0000 Subject: [PATCH] declare type warning --- .../org/aspectj/weaver/CrosscuttingMembers.java | 9 +++++++++ .../aspectj/weaver/CrosscuttingMembersSet.java | 17 +++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembers.java b/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembers.java index 14de71e79..af2fe22ce 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembers.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembers.java @@ -27,6 +27,7 @@ import org.aspectj.weaver.patterns.DeclareErrorOrWarning; import org.aspectj.weaver.patterns.DeclareParents; import org.aspectj.weaver.patterns.DeclarePrecedence; import org.aspectj.weaver.patterns.DeclareSoft; +import org.aspectj.weaver.patterns.DeclareTypeErrorOrWarning; import org.aspectj.weaver.patterns.PerClause; import org.aspectj.weaver.patterns.Pointcut; import org.aspectj.weaver.patterns.PointcutRewriter; @@ -62,6 +63,8 @@ public class CrosscuttingMembers { private Set declareAnnotationsOnMethods = new HashSet(); // declareAnnotationsOnMethods includes constructors too + private Set declareTypeEow = new HashSet(); + private boolean shouldConcretizeIfNeeded = true; public CrosscuttingMembers(ResolvedType inAspect, boolean shouldConcretizeIfNeeded) { @@ -156,6 +159,8 @@ public class CrosscuttingMembers { } else if (da.isDeclareAtMethod() || da.isDeclareAtConstuctor()) { declareAnnotationsOnMethods.add(da); } + } else if (declare instanceof DeclareTypeErrorOrWarning) { + declareTypeEow.add((DeclareTypeErrorOrWarning) declare); } else { throw new RuntimeException("unimplemented"); } @@ -538,6 +543,10 @@ public class CrosscuttingMembers { return declareAnnotationsOnMethods; } + public Collection getDeclareTypeErrorOrWarning() { + return declareTypeEow; + } + public Map getCflowBelowFields() { return cflowBelowFields; } diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembersSet.java b/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembersSet.java index d81ef0b2c..04d23488f 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembersSet.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembersSet.java @@ -26,6 +26,7 @@ import org.aspectj.weaver.patterns.Declare; import org.aspectj.weaver.patterns.DeclareAnnotation; import org.aspectj.weaver.patterns.DeclareParents; import org.aspectj.weaver.patterns.DeclareSoft; +import org.aspectj.weaver.patterns.DeclareTypeErrorOrWarning; import org.aspectj.weaver.patterns.IVerificationRequired; import org.aspectj.weaver.tools.Trace; import org.aspectj.weaver.tools.TraceFactory; @@ -56,6 +57,7 @@ public class CrosscuttingMembersSet { private List declareAnnotationOnTypes = null; private List declareAnnotationOnFields = null; private List declareAnnotationOnMethods = null; // includes constructors + private List declareTypeEows = null; private List declareDominates = null; private boolean changedSinceLastReset = false; @@ -301,6 +303,21 @@ public class CrosscuttingMembersSet { return declareAnnotationOnMethods; } + /** + * Return an amalgamation of the declare type eow statements + */ + public List getDeclareTypeEows() { + if (declareTypeEows == null) { + Set ret = new HashSet(); + for (Iterator i = members.values().iterator(); i.hasNext();) { + ret.addAll(i.next().getDeclareTypeErrorOrWarning()); + } + declareTypeEows = new ArrayList(); + declareTypeEows.addAll(ret); + } + return declareTypeEows; + } + public List getDeclareDominates() { if (declareDominates == null) { List ret = new ArrayList(); -- 2.39.5