From: aclement Date: Wed, 24 Nov 2010 19:37:07 +0000 (+0000) Subject: 329925: declare @field remove annotation X-Git-Tag: V1_6_11M1~32 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=2832d267f287d6b846e7af1b56140e640886ca5a;p=aspectj.git 329925: declare @field remove annotation --- diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareAnnotation.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareAnnotation.java index ddd526f96..ba1d29415 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareAnnotation.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareAnnotation.java @@ -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; + } } diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java index 320fe2121..3bddbfc80 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java @@ -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() {