aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher/src
diff options
context:
space:
mode:
authorAndy Clement <aclement@pivotal.io>2019-01-09 13:23:02 -0800
committerAndy Clement <aclement@pivotal.io>2019-01-09 13:23:02 -0800
commitb21a59365261d248f36c77446ec2b011dffd9a52 (patch)
treea75a7e89dae07488d40990a8e730dc02fe41c7fd /org.aspectj.matcher/src
parent450c1fe05731c1084bfabb22d7595f39ac19b8c6 (diff)
downloadaspectj-b21a59365261d248f36c77446ec2b011dffd9a52.tar.gz
aspectj-b21a59365261d248f36c77446ec2b011dffd9a52.zip
better infrastructure for checking pointcuts terminate correctly - inactive right now
Diffstat (limited to 'org.aspectj.matcher/src')
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/patterns/BasicTokenSource.java5
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/patterns/ITokenSource.java1
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java16
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/tools/PointcutParser.java2
4 files changed, 22 insertions, 2 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/BasicTokenSource.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/BasicTokenSource.java
index ccde927f4..0a099529b 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/BasicTokenSource.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/BasicTokenSource.java
@@ -180,4 +180,9 @@ public class BasicTokenSource implements ITokenSource {
this.sourceContext = context;
}
+ @Override
+ public boolean hasMoreTokens() {
+ return index < tokens.length;
+ }
+
}
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ITokenSource.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ITokenSource.java
index ea777a47f..4649b046f 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ITokenSource.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/ITokenSource.java
@@ -23,4 +23,5 @@ public interface ITokenSource {
public int getIndex();
public void setIndex(int newIndex);
public ISourceContext getSourceContext();
+ public boolean hasMoreTokens();
}
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 f3bf08833..effecfeaf 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java
@@ -97,6 +97,10 @@ public class PatternParser {
eat(")");
return new PerCflow(entry, isBelow);
}
+
+ public boolean moreToParse() {
+ return tokenSource.hasMoreTokens();
+ }
private PerClause parsePerObject(boolean isThis) {
parseIdentifier();
@@ -330,6 +334,16 @@ public class PatternParser {
String message = parsePossibleStringSequence(true);
return new DeclareErrorOrWarning(isError, pointcut, message);
}
+
+ public Pointcut parsePointcut(boolean shouldConsumeAllInput) {
+ Pointcut p = parsePointcut();
+ if (shouldConsumeAllInput && tokenSource.hasMoreTokens()) {
+ throw new ParserException(
+ "Found unexpected data after parsing pointcut",
+ tokenSource.next());
+ }
+ return p;
+ }
public Pointcut parsePointcut() {
Pointcut p = parseAtomicPointcut();
@@ -343,7 +357,7 @@ public class PatternParser {
return p;
}
-
+
private Pointcut parseNotOrPointcut() {
Pointcut p = parseAtomicPointcut();
if (maybeEat("&&")) {
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/tools/PointcutParser.java b/org.aspectj.matcher/src/org/aspectj/weaver/tools/PointcutParser.java
index 4e3b2bd59..ca0fa3aca 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/tools/PointcutParser.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/tools/PointcutParser.java
@@ -325,7 +325,7 @@ public class PointcutParser {
try {
PatternParser parser = new PatternParser(expression);
parser.setPointcutDesignatorHandlers(pointcutDesignators, world);
- Pointcut pc = parser.parsePointcut();
+ Pointcut pc = parser.parsePointcut(); // more correctly: parsePointcut(true)
validateAgainstSupportedPrimitives(pc, expression);
IScope resolutionScope = buildResolutionScope((inScope == null ? Object.class : inScope), formalParameters);
pc = pc.resolve(resolutionScope);