--- /dev/null
+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 {}
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.