summaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher
diff options
context:
space:
mode:
authoraclement <aclement>2010-04-05 22:23:55 +0000
committeraclement <aclement>2010-04-05 22:23:55 +0000
commit70eb59751815d16feddae8207b68d112f07623e8 (patch)
tree95b35f6de3694a6256d6931d8eb5b703434c07eb /org.aspectj.matcher
parent8a5ede2498244d3938d2d2508ebf2bb3a4179abd (diff)
downloadaspectj-70eb59751815d16feddae8207b68d112f07623e8.tar.gz
aspectj-70eb59751815d16feddae8207b68d112f07623e8.zip
292264: declare error/warning with type patterns
Diffstat (limited to 'org.aspectj.matcher')
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembers.java4
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/World.java7
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java30
3 files changed, 37 insertions, 4 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembers.java b/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembers.java
index af2fe22ce..5ada3efc9 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembers.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/CrosscuttingMembers.java
@@ -454,6 +454,10 @@ public class CrosscuttingMembers {
changed = true;
declareAnnotationsOnMethods = other.declareAnnotationsOnMethods;
}
+ if (!declareTypeEow.equals(other.declareTypeEow)) {
+ changed = true;
+ declareTypeEow = other.declareTypeEow;
+ }
return changed;
}
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/World.java b/org.aspectj.matcher/src/org/aspectj/weaver/World.java
index 2736e64e9..cf38789ff 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/World.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/World.java
@@ -41,6 +41,7 @@ import org.aspectj.weaver.patterns.DeclareAnnotation;
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.Pointcut;
import org.aspectj.weaver.patterns.TypePattern;
import org.aspectj.weaver.tools.PointcutDesignatorHandler;
@@ -736,9 +737,9 @@ public abstract class World implements Dump.INode {
return crosscuttingMembersSet.getDeclareAnnotationOnMethods();
}
- // public List<DeclareTypeErrorOrWarning> getDeclareTypeEows() {
- // return crosscuttingMembersSet.getDeclareTypeEows();
- // }
+ public List<DeclareTypeErrorOrWarning> getDeclareTypeEows() {
+ return crosscuttingMembersSet.getDeclareTypeEows();
+ }
public List<DeclareSoft> getDeclareSoft() {
return crosscuttingMembersSet.getDeclareSofts();
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java
index 8aeb64720..1062c79c9 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java
@@ -256,8 +256,36 @@ public class PatternParser {
return new DeclareSoft(p, pointcut);
}
+ /**
+ * Attempt to parse a pointcut, if that fails then try again for a type pattern.
+ *
+ * @param isError true if it is declare error rather than declare warning
+ * @return the new declare
+ */
private Declare parseErrorOrWarning(boolean isError) {
- Pointcut pointcut = parsePointcut();
+ Pointcut pointcut = null;
+ int index = tokenSource.getIndex();
+ try {
+ pointcut = parsePointcut();
+ } catch (ParserException pe) {
+ try {
+ tokenSource.setIndex(index);
+ boolean oldValue = allowHasTypePatterns;
+ TypePattern typePattern = null;
+ try {
+ allowHasTypePatterns = true;
+ typePattern = parseTypePattern();
+ } finally {
+ allowHasTypePatterns = oldValue;
+ }
+ eat(":");
+ String message = parsePossibleStringSequence(true);
+ return new DeclareTypeErrorOrWarning(isError, typePattern, message);
+ } catch (ParserException pe2) {
+ // deliberately throw the original problem
+ throw pe;
+ }
+ }
eat(":");
String message = parsePossibleStringSequence(true);
return new DeclareErrorOrWarning(isError, pointcut, message);