From: jhugunin Date: Wed, 1 Jan 2003 01:32:00 +0000 (+0000) Subject: better errors for dominates circularities X-Git-Tag: V_1_1_b5~179 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=768fe44deed3fe6ed56d90bbee8393e06761d265;p=aspectj.git better errors for dominates circularities --- diff --git a/weaver/src/org/aspectj/weaver/patterns/DeclareDominates.java b/weaver/src/org/aspectj/weaver/patterns/DeclareDominates.java index 87eed741d..35d9e071c 100644 --- a/weaver/src/org/aspectj/weaver/patterns/DeclareDominates.java +++ b/weaver/src/org/aspectj/weaver/patterns/DeclareDominates.java @@ -64,7 +64,24 @@ public class DeclareDominates extends Declare { } public void resolve(IScope scope) { - patterns = patterns.resolveBindings(scope, Bindings.NONE, false, false); + patterns = patterns.resolveBindings(scope, Bindings.NONE, false, false); + + for (int i=0; i < patterns.size(); i++) { + TypePattern pi = patterns.get(i); + if (pi.isStar()) continue; + ResolvedTypeX exactType = pi.getExactType().resolve(scope.getWorld()); + if (exactType == ResolvedTypeX.MISSING) continue; + for (int j=0; j < patterns.size(); j++) { + if (j == i) continue; + TypePattern pj = patterns.get(j); + if (pj.isStar()) continue; + if (pj.matchesStatically(exactType)) { + scope.getWorld().showMessage(IMessage.ERROR, + "circularity in declare dominates, '" + exactType.getName() + + "' matches two patterns", pi.getSourceLocation(), pj.getSourceLocation()); + } + } + } } public TypePatternList getPatterns() {