aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher
diff options
context:
space:
mode:
authoraclement <aclement>2009-01-29 23:56:36 +0000
committeraclement <aclement>2009-01-29 23:56:36 +0000
commit79eda2ed361fc73ae14e9c96b6c6c9f1174ba5f6 (patch)
treecdee4621d45bba7b1d1bb1d98f6ac1d7c8b9879e /org.aspectj.matcher
parent69a79e20f60efdc344a0a354b254fe72019907f5 (diff)
downloadaspectj-79eda2ed361fc73ae14e9c96b6c6c9f1174ba5f6.tar.gz
aspectj-79eda2ed361fc73ae14e9c96b6c6c9f1174ba5f6.zip
256779: test and fix: decp lazy resolution in anno style
Diffstat (limited to 'org.aspectj.matcher')
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclarePrecedence.java26
1 files changed, 19 insertions, 7 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclarePrecedence.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclarePrecedence.java
index cefec1661..896344557 100644
--- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclarePrecedence.java
+++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclarePrecedence.java
@@ -26,6 +26,7 @@ import org.aspectj.weaver.World;
public class DeclarePrecedence extends Declare {
private TypePatternList patterns;
+ private IScope scope = null; // non-null means it has not yet been resolved (used by annotation style lazy resolution)
public DeclarePrecedence(List patterns) {
this(new TypePatternList(patterns));
@@ -76,13 +77,21 @@ public class DeclarePrecedence extends Declare {
return ret;
}
- boolean underResolution = false;
+ public void setScopeForResolution(IScope scope) {
+ this.scope = scope;
+ }
+
+ public void ensureResolved() { // Lazy resolution - due to pr256779
+ if (scope != null) {
+ try {
+ resolve(scope);
+ } finally {
+ scope = null;
+ }
+ }
+ }
public void resolve(IScope scope) {
- // if (underResolution) {
- // return;
- // }
- // underResolution = true;
patterns = patterns.resolveBindings(scope, Bindings.NONE, false, false);
boolean seenStar = false;
@@ -101,7 +110,8 @@ public class DeclarePrecedence extends Declare {
continue;
// Cannot do a dec prec specifying a non-aspect types unless suffixed with a '+'
- if (!exactType.isAspect() && !pi.isIncludeSubtypes() && !exactType.isTypeVariableReference()) {
+ if (!exactType.isAspect() && !exactType.isAnnotationStyleAspect() && !pi.isIncludeSubtypes()
+ && !exactType.isTypeVariableReference()) {
scope.getWorld().showMessage(IMessage.ERROR,
WeaverMessages.format(WeaverMessages.CLASSES_IN_PRECEDENCE, exactType.getName()), pi.getSourceLocation(),
null);
@@ -119,15 +129,16 @@ public class DeclarePrecedence extends Declare {
pi.getSourceLocation(), pj.getSourceLocation());
}
}
- // underResolution = false;
}
}
public TypePatternList getPatterns() {
+ ensureResolved();
return patterns;
}
private int matchingIndex(ResolvedType a) {
+ ensureResolved();
int knownMatch = -1;
int starMatch = -1;
for (int i = 0, len = patterns.size(); i < len; i++) {
@@ -152,6 +163,7 @@ public class DeclarePrecedence extends Declare {
}
public int compare(ResolvedType aspect1, ResolvedType aspect2) {
+ ensureResolved();
int index1 = matchingIndex(aspect1);
int index2 = matchingIndex(aspect2);