]> source.dussan.org Git - aspectj.git/commitdiff
329925: declare @field remove annotation
authoraclement <aclement>
Wed, 24 Nov 2010 19:37:07 +0000 (19:37 +0000)
committeraclement <aclement>
Wed, 24 Nov 2010 19:37:07 +0000 (19:37 +0000)
org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareAnnotation.java
org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java

index ddd526f96e2f0da7c4f0571e204deff048507f72..ba1d2941513d078f3b03b7924ee55110d98bab04 100644 (file)
@@ -41,6 +41,7 @@ public class DeclareAnnotation extends Declare {
        public static final Kind AT_FIELD = new Kind(2, "field");
        public static final Kind AT_METHOD = new Kind(3, "method");
        public static final Kind AT_CONSTRUCTOR = new Kind(4, "constructor");
+       public static final Kind AT_REMOVE_FROM_FIELD = new Kind(5, "removeFromField");
 
        private Kind kind;
        // for declare @type
@@ -227,7 +228,11 @@ public class DeclareAnnotation extends Declare {
        @Override
        public void write(CompressingDataOutputStream s) throws IOException {
                s.writeByte(Declare.ANNOTATION);
-               s.writeInt(kind.id);
+               if (kind.id == AT_FIELD.id && isRemover) {
+                       s.writeInt(AT_REMOVE_FROM_FIELD.id);
+               } else {
+                       s.writeInt(kind.id);
+               }
                int max = 0;
                s.writeByte(max = annotationStrings.size());
                for (int i = 0; i < max; i++) {
@@ -248,7 +253,12 @@ public class DeclareAnnotation extends Declare {
 
        public static Declare read(VersionedDataInputStream s, ISourceContext context) throws IOException {
                DeclareAnnotation ret = null;
+               boolean isRemover = false;
                int kind = s.readInt();
+               if (kind == AT_REMOVE_FROM_FIELD.id) {
+                       kind = AT_FIELD.id;
+                       isRemover = true;
+               }
                // old format was just a single string and method
                if (s.getMajorVersion() >= WeaverVersionInfo.WEAVER_VERSION_AJ169) {
                        // int numAnnotationStrings =
@@ -274,6 +284,9 @@ public class DeclareAnnotation extends Declare {
                                sp = SignaturePattern.read(s, context);
                                ret = new DeclareAnnotation(AT_FIELD, sp);
                        }
+                       if (isRemover) {
+                               ret.setRemover(true);
+                       }
                        break;
                case 3:
                        if (s.getMajorVersion() >= WeaverVersionInfo.WEAVER_VERSION_AJ169) {
@@ -511,4 +524,14 @@ public class DeclareAnnotation extends Declare {
                        return "at_" + s;
                }
        }
+
+       boolean isRemover = false;
+
+       public void setRemover(boolean b) {
+               isRemover = b;
+       }
+
+       public boolean isRemover() {
+               return isRemover;
+       }
 }
index 320fe2121a9bd6a96d0053b07d0998aeec49c4d7..3bddbfc807d6ac759a7d22ff0a50ca16ffbf15ae 100644 (file)
@@ -198,7 +198,8 @@ public class PatternParser {
 
        public DeclareAnnotation parseDeclareAtField() {
                ISignaturePattern compoundFieldSignaturePattern = parseCompoundFieldSignaturePattern();
-               return new DeclareAnnotation(DeclareAnnotation.AT_FIELD, compoundFieldSignaturePattern);
+               DeclareAnnotation da = new DeclareAnnotation(DeclareAnnotation.AT_FIELD, compoundFieldSignaturePattern);
+               return da;
        }
 
        public ISignaturePattern parseCompoundFieldSignaturePattern() {