From: aclement Date: Mon, 31 Jan 2005 13:22:49 +0000 (+0000) Subject: Puts out binding restriction message for unsupported kinded pcds - also verifies... X-Git-Tag: Root_AspectJ5_Development~9 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=acaa6123b95d96221799cd1422c7dcc1e9cef584;p=aspectj.git Puts out binding restriction message for unsupported kinded pcds - also verifies an assumption. --- diff --git a/weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java b/weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java index 8cc80a37a..2de0e2228 100644 --- a/weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java +++ b/weaver/src/org/aspectj/weaver/patterns/AnnotationPointcut.java @@ -17,8 +17,11 @@ import java.util.Collections; import java.util.List; import java.util.Set; +import org.aspectj.bridge.IMessage; +import org.aspectj.bridge.MessageUtil; import org.aspectj.util.FuzzyBoolean; import org.aspectj.weaver.AnnotatedElement; +import org.aspectj.weaver.BCException; import org.aspectj.weaver.ISourceContext; import org.aspectj.weaver.IntMap; import org.aspectj.weaver.Member; @@ -144,12 +147,27 @@ public class AnnotationPointcut extends NameBindingPointcut { * @see org.aspectj.weaver.patterns.Pointcut#findResidue(org.aspectj.weaver.Shadow, org.aspectj.weaver.patterns.ExposedState) */ protected Test findResidueInternal(Shadow shadow, ExposedState state) { + + if (shadow.getKind()!=Shadow.MethodCall && + shadow.getKind()!=Shadow.MethodExecution) { + IMessage lim = MessageUtil.error("Binding not supported in @pcds (1.5.0 M2 limitation) for "+shadow.getKind()+" join points, see: " + + getSourceLocation()); + shadow.getIWorld().getMessageHandler().handleMessage(lim); + throw new BCException("Binding not supported in @pcds (1.5.0 M2 limitation) for "+shadow.getKind()+" join points, see: " + + getSourceLocation()); + } + if (annotationTypePattern instanceof BindingAnnotationTypePattern) { BindingAnnotationTypePattern btp = (BindingAnnotationTypePattern)annotationTypePattern; TypeX annotationType = btp.annotationType; Var var = shadow.getKindedAnnotationVar(annotationType); - if (var == null) return Literal.FALSE; + + // This should not happen, we shouldn't have gotten this var + // if we weren't going to find the annotation + if (var == null) throw new BCException("Impossible! annotation=["+annotationType+ + "] shadow=["+shadow+" at "+shadow.getSourceLocation()+ + "] pointcut is at ["+getSourceLocation()+"]");//return Literal.FALSE; // Check if we have already bound something to this formal if ((state.get(btp.getFormalIndex())!=null) &&(lastMatchedShadowId == shadow.shadowId)) { // ISourceLocation pcdSloc = getSourceLocation();