summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraclement <aclement>2010-11-25 21:45:54 +0000
committeraclement <aclement>2010-11-25 21:45:54 +0000
commitaffd2cc672dc4463e8be4abf8329b0d14a9d0581 (patch)
tree17bca7e13d9177a6029ebd76ac77ca4303872d74 /tests
parentba1db7de28aa4218214f98c33368b1c5a7133d44 (diff)
downloadaspectj-affd2cc672dc4463e8be4abf8329b0d14a9d0581.tar.gz
aspectj-affd2cc672dc4463e8be4abf8329b0d14a9d0581.zip
annotation removal tests
Diffstat (limited to 'tests')
-rw-r--r--tests/multiIncremental/annoRemoval/base/a/Code.java18
-rw-r--r--tests/src/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java21
2 files changed, 39 insertions, 0 deletions
diff --git a/tests/multiIncremental/annoRemoval/base/a/Code.java b/tests/multiIncremental/annoRemoval/base/a/Code.java
new file mode 100644
index 000000000..f776facf4
--- /dev/null
+++ b/tests/multiIncremental/annoRemoval/base/a/Code.java
@@ -0,0 +1,18 @@
+package a;
+import java.lang.annotation.*;
+
+aspect Remover{
+ declare @field: int Code.i: -@Anno;
+ declare @field: int Code.j: @Anno;
+}
+
+public class Code {
+
+ @Anno
+ public int i;
+
+ public int j;
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface Anno {}
diff --git a/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java b/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java
index 12dec55e0..5e33fa63c 100644
--- a/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java
+++ b/tests/src/org/aspectj/systemtest/incremental/tools/IncrementalCompilationTests.java
@@ -82,6 +82,27 @@ public class IncrementalCompilationTests extends AbstractMultiProjectIncremental
assertContains("B.java:4:0::0 Unhandled exception type IOException", getErrorMessages(p).get(0));
}
+ public void testDeclareFieldMinus() throws Exception {
+ String p = "annoRemoval";
+ initialiseProject(p);
+ build(p);
+ checkWasFullBuild();
+ AspectJElementHierarchy model = (AspectJElementHierarchy) getModelFor(p).getHierarchy();
+ IProgramElement ipe = null;
+ ipe = model.findElementForHandleOrCreate("=annoRemoval<a{Code.java'Remover`declare \\@field", false);
+ System.out.println(ipe);
+ assertTrue(ipe.isAnnotationRemover());
+ String[] annos = ipe.getRemovedAnnotationTypes();
+ assertEquals(1, annos.length);
+ assertEquals("a.Anno", annos[0]);
+ assertNull(ipe.getAnnotationType());
+ ipe = model.findElementForHandleOrCreate("=annoRemoval<a{Code.java'Remover`declare \\@field!2", false);
+ System.out.println(ipe);
+ assertFalse(ipe.isAnnotationRemover());
+ assertEquals("a.Anno", ipe.getAnnotationType());
+ assertNull(ipe.getRemovedAnnotationTypes());
+ }
+
/**
* Build a pair of files, then change the throws clause in the first one (change the type of the thrown exception). The second
* file should now have a 'unhandled exception' error on it.