summaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher
diff options
context:
space:
mode:
authoraclement <aclement>2010-11-24 19:37:07 +0000
committeraclement <aclement>2010-11-24 19:37:07 +0000
commit2832d267f287d6b846e7af1b56140e640886ca5a (patch)
tree681d8e7bec57cb110d615839e72c1ef60b3ace08 /org.aspectj.matcher
parent624e0ac0c2e931d00a8261e79af22af2ba720fc7 (diff)
downloadaspectj-2832d267f287d6b846e7af1b56140e640886ca5a.tar.gz
aspectj-2832d267f287d6b846e7af1b56140e640886ca5a.zip
329925: declare @field remove annotation
Diffstat (limited to 'org.aspectj.matcher')
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/patterns/DeclareAnnotation.java25
-rw-r--r--org.aspectj.matcher/src/org/aspectj/weaver/patterns/PatternParser.java3
2 files changed, 26 insertions, 2 deletions
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() {