aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authoracolyer <acolyer>2004-12-09 10:33:44 +0000
committeracolyer <acolyer>2004-12-09 10:33:44 +0000
commitd293b89939ff681054b47aa48ce6942bb9fcb2b4 (patch)
treee53ee0ea82e7e452f8da6d2f83c73791d3260cef /weaver
parente316730e3d8a4a47b8dc8c0c2ee31421bb77c98d (diff)
downloadaspectj-d293b89939ff681054b47aa48ce6942bb9fcb2b4.tar.gz
aspectj-d293b89939ff681054b47aa48ce6942bb9fcb2b4.zip
fail gracefully when trying to bind in an @pcd
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/BindingAnnotationTypePattern.java6
-rw-r--r--weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java6
-rw-r--r--weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java16
3 files changed, 22 insertions, 6 deletions
diff --git a/weaver/src/org/aspectj/weaver/patterns/BindingAnnotationTypePattern.java b/weaver/src/org/aspectj/weaver/patterns/BindingAnnotationTypePattern.java
index d00dec37e..1a369fccf 100644
--- a/weaver/src/org/aspectj/weaver/patterns/BindingAnnotationTypePattern.java
+++ b/weaver/src/org/aspectj/weaver/patterns/BindingAnnotationTypePattern.java
@@ -39,6 +39,12 @@ public class BindingAnnotationTypePattern extends ExactAnnotationTypePattern imp
}
public AnnotationTypePattern resolve(World world) {
+ // For 1.5.0 M1
+ IMessage lim = MessageUtil.error("Binding not supported in @pcds (1.5.0 M1 limitation): " +
+ getSourceLocation());
+ world.getMessageHandler().handleMessage(lim);
+ // End of 1.5.0 M1
+
if (resolved) return this;
resolved = true;
annotationType = annotationType.resolve(world);
diff --git a/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java b/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java
index 9945dc0d8..ba404c0cd 100644
--- a/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java
+++ b/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java
@@ -126,11 +126,15 @@ public class AnnotationPatternMatchingTestCase extends TestCase {
AnnotationTypePattern atp = p.parseAnnotationNameOrVarTypePattern();
atp = atp.resolveBindings(makeSimpleScope(),new Bindings(3),true);
- assertTrue("Expected 1 error message but got "+mh.messages.size(),mh.messages.size()==1);
+ assertTrue("Expected 2 error messages but got "+mh.messages.size(),mh.messages.size()==2);
String expected = "Type referred to is not an annotation type";
String msg = ((IMessage)mh.messages.get(0)).toString();
assertTrue("Expected: "+expected+" but got "+msg,msg.indexOf(expected)!=-1);
+
+ expected = "Binding not supported in @pcds (1.5.0 M1 limitation): null";
+ msg = ((IMessage)mh.messages.get(1)).toString();
+ assertTrue("Expected: "+expected+" but got "+msg,msg.indexOf(expected)!=-1);
}
public TestScope makeSimpleScope() {
diff --git a/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java b/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java
index 2a4ce76fd..464d2e9ec 100644
--- a/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java
+++ b/weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java
@@ -9,6 +9,7 @@
* ******************************************************************/
package org.aspectj.weaver.patterns;
+import org.aspectj.bridge.AbortException;
import org.aspectj.weaver.AnnotatedElement;
import org.aspectj.weaver.ResolvedTypeX;
import org.aspectj.weaver.BcweaverTests;
@@ -257,11 +258,16 @@ public class AnnotationPatternTestCase extends TestCase {
public void testBindingAnnotationPatternMatching() {
PatternParser p = new PatternParser("foo");
AnnotationTypePattern ap = p.parseAnnotationNameOrVarTypePattern();
- ap = ap.resolveBindings(makeSimpleScope(),new Bindings(3),true);
- AnnotatedElementImpl ae = new AnnotatedElementImpl(new String[]{"Foo"});
- assertTrue("matches element with Foo",ap.matches(ae).alwaysTrue());
- AnnotatedElementImpl ae2 = new AnnotatedElementImpl(new String[]{"Boo"});
- assertTrue("does not match element with Boo",ap.matches(ae2).alwaysFalse());
+ try {
+ ap = ap.resolveBindings(makeSimpleScope(),new Bindings(3),true);
+ } catch(AbortException abEx) {
+ assertEquals("Binding not supported in @pcds (1.5.0 M1 limitation): null",abEx.getMessage());
+ }
+ // uncomment these next lines once binding is supported
+// AnnotatedElementImpl ae = new AnnotatedElementImpl(new String[]{"Foo"});
+// assertTrue("matches element with Foo",ap.matches(ae).alwaysTrue());
+// AnnotatedElementImpl ae2 = new AnnotatedElementImpl(new String[]{"Boo"});
+// assertTrue("does not match element with Boo",ap.matches(ae2).alwaysFalse());
}
public void testAndAnnotationPatternMatching() {