diff options
author | aclement <aclement> | 2011-04-28 19:59:35 +0000 |
---|---|---|
committer | aclement <aclement> | 2011-04-28 19:59:35 +0000 |
commit | 35409d862033981f275c9150f97023de411c1048 (patch) | |
tree | 15679ecb1727a18acfc04b5fd6426675a18e13ff /tests/multiIncremental | |
parent | 464d48469d8cf1255daae2eecb2f1b9d453d1616 (diff) | |
download | aspectj-35409d862033981f275c9150f97023de411c1048.tar.gz aspectj-35409d862033981f275c9150f97023de411c1048.zip |
328121
Diffstat (limited to 'tests/multiIncremental')
-rw-r--r-- | tests/multiIncremental/pr328121/base/src/TestRequirements/TestRequirements.java | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/multiIncremental/pr328121/base/src/TestRequirements/TestRequirements.java b/tests/multiIncremental/pr328121/base/src/TestRequirements/TestRequirements.java new file mode 100644 index 000000000..3d4c29f18 --- /dev/null +++ b/tests/multiIncremental/pr328121/base/src/TestRequirements/TestRequirements.java @@ -0,0 +1,33 @@ +package TestRequirements; + +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; + + +@Retention(RetentionPolicy.RUNTIME) +@interface AnnotatedMethod {} + +@Retention(RetentionPolicy.RUNTIME) +@interface NewAnnotatedMethod { + boolean newValue(); +} + +aspect X { + declare @method: !@AnnotatedMethod * TestRequirements.*(..) : @NewAnnotatedMethod(newValue = true); +} + +public class TestRequirements { + @AnnotatedMethod + public void dontMatchMe() {} + + public void matchMe() {} + + public static void foo() throws Exception { + if (TestRequirements.class.getDeclaredMethod("dontMatchMe").getAnnotation(NewAnnotatedMethod.class)!=null) { + throw new IllegalStateException(); + } + if (TestRequirements.class.getDeclaredMethod("matchMe").getAnnotation(NewAnnotatedMethod.class)==null) { + throw new IllegalStateException(); + } + } +} |