aboutsummaryrefslogtreecommitdiffstats
path: root/weaver/testsrc/org
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/testsrc/org
parente316730e3d8a4a47b8dc8c0c2ee31421bb77c98d (diff)
downloadaspectj-d293b89939ff681054b47aa48ce6942bb9fcb2b4.tar.gz
aspectj-d293b89939ff681054b47aa48ce6942bb9fcb2b4.zip
fail gracefully when trying to bind in an @pcd
Diffstat (limited to 'weaver/testsrc/org')
-rw-r--r--weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternMatchingTestCase.java6
-rw-r--r--weaver/testsrc/org/aspectj/weaver/patterns/AnnotationPatternTestCase.java16
2 files changed, 16 insertions, 6 deletions
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() {