diff options
author | aclement <aclement> | 2009-10-30 23:01:38 +0000 |
---|---|---|
committer | aclement <aclement> | 2009-10-30 23:01:38 +0000 |
commit | 715ea62d111eec1132c764a868aaf968259450c8 (patch) | |
tree | 98df59c0c7891693d18c4135001c9f727fa1404e /org.aspectj.matcher | |
parent | 44f08af6a0915a0102cdf1cc228faef5c2607553 (diff) | |
download | aspectj-715ea62d111eec1132c764a868aaf968259450c8.tar.gz aspectj-715ea62d111eec1132c764a868aaf968259450c8.zip |
formatted
Diffstat (limited to 'org.aspectj.matcher')
-rw-r--r-- | org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnnotationTypePattern.java | 114 |
1 files changed, 67 insertions, 47 deletions
diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnnotationTypePattern.java b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnnotationTypePattern.java index e9ea8541f..79edd61ee 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnnotationTypePattern.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/patterns/AnnotationTypePattern.java @@ -28,41 +28,40 @@ public abstract class AnnotationTypePattern extends PatternNode { public static final AnnotationTypePattern ELLIPSIS = new EllipsisAnnotationTypePattern(); public static final AnnotationTypePattern[] NONE = new AnnotationTypePattern[0]; private boolean isForParameterAnnotationMatch; - + /** - * TODO: write, read, equals & hashcode both in annotation hierarachy and - * in altered TypePattern hierarchy + * TODO: write, read, equals & hashcode both in annotation hierarachy and in altered TypePattern hierarchy */ protected AnnotationTypePattern() { super(); } - + public abstract FuzzyBoolean matches(AnnotatedElement annotated); - public abstract FuzzyBoolean matches(AnnotatedElement annotated,ResolvedType[] parameterAnnotations); - + + public abstract FuzzyBoolean matches(AnnotatedElement annotated, ResolvedType[] parameterAnnotations); + public FuzzyBoolean fastMatches(AnnotatedElement annotated) { return FuzzyBoolean.MAYBE; } - + public AnnotationTypePattern remapAdviceFormals(IntMap bindings) { return this; } - + public abstract void resolve(World world); - - public abstract AnnotationTypePattern parameterizeWith(Map/*name -> ResolvedType*/ typeVariableMap,World w); - - public boolean isAny() { return false; } - + + public abstract AnnotationTypePattern parameterizeWith(Map/* name -> ResolvedType */typeVariableMap, World w); + + public boolean isAny() { + return false; + } + /** * This can modify in place, or return a new TypePattern if the type changes. */ - public AnnotationTypePattern resolveBindings(IScope scope, Bindings bindings, - boolean allowBinding) - { - return this; - } - + public AnnotationTypePattern resolveBindings(IScope scope, Bindings bindings, boolean allowBinding) { + return this; + } public static final byte EXACT = 1; public static final byte BINDING = 2; @@ -72,59 +71,80 @@ public abstract class AnnotationTypePattern extends PatternNode { public static final byte ELLIPSIS_KEY = 6; public static final byte ANY_KEY = 7; public static final byte WILD = 8; - public static final byte EXACTFIELD = 9; - public static final byte BINDINGFIELD = 10; + public static final byte EXACTFIELD = 9; + public static final byte BINDINGFIELD = 10; public static AnnotationTypePattern read(VersionedDataInputStream s, ISourceContext context) throws IOException { byte key = s.readByte(); - switch(key) { - case EXACT: return ExactAnnotationTypePattern.read(s, context); - case BINDING: return BindingAnnotationTypePattern.read(s, context); - case NOT: return NotAnnotationTypePattern.read(s, context); - case OR: return OrAnnotationTypePattern.read(s, context); - case AND: return AndAnnotationTypePattern.read(s, context); - case WILD: return WildAnnotationTypePattern.read(s,context); - case EXACTFIELD: - return ExactAnnotationFieldTypePattern.read(s, context); - case BINDINGFIELD: - return BindingAnnotationFieldTypePattern.read(s, context); - case ELLIPSIS_KEY: return ELLIPSIS; - case ANY_KEY: return ANY; + switch (key) { + case EXACT: + return ExactAnnotationTypePattern.read(s, context); + case BINDING: + return BindingAnnotationTypePattern.read(s, context); + case NOT: + return NotAnnotationTypePattern.read(s, context); + case OR: + return OrAnnotationTypePattern.read(s, context); + case AND: + return AndAnnotationTypePattern.read(s, context); + case WILD: + return WildAnnotationTypePattern.read(s, context); + case EXACTFIELD: + return ExactAnnotationFieldTypePattern.read(s, context); + case BINDINGFIELD: + return BindingAnnotationFieldTypePattern.read(s, context); + case ELLIPSIS_KEY: + return ELLIPSIS; + case ANY_KEY: + return ANY; } throw new BCException("unknown TypePattern kind: " + key); } - public void setForParameterAnnotationMatch() { isForParameterAnnotationMatch = true; } - public boolean isForParameterAnnotationMatch() { return isForParameterAnnotationMatch; } + public void setForParameterAnnotationMatch() { + isForParameterAnnotationMatch = true; + } -} + public boolean isForParameterAnnotationMatch() { + return isForParameterAnnotationMatch; + } +} class EllipsisAnnotationTypePattern extends AnnotationTypePattern { + @Override public FuzzyBoolean matches(AnnotatedElement annotated) { return FuzzyBoolean.NO; } - public FuzzyBoolean matches(AnnotatedElement annotated,ResolvedType[] parameterAnnotations) { + @Override + public FuzzyBoolean matches(AnnotatedElement annotated, ResolvedType[] parameterAnnotations) { return FuzzyBoolean.NO; } + @Override public void write(DataOutputStream s) throws IOException { s.writeByte(AnnotationTypePattern.ELLIPSIS_KEY); } + @Override public void resolve(World world) { } - public String toString() { return ".."; } + @Override + public String toString() { + return ".."; + } + + @Override + public Object accept(PatternNodeVisitor visitor, Object data) { + return visitor.visit(this, data); + } + + @Override + public AnnotationTypePattern parameterizeWith(Map arg0, World w) { + return this; + } - public Object accept(PatternNodeVisitor visitor, Object data) { - return visitor.visit(this, data); - } - - public AnnotationTypePattern parameterizeWith(Map arg0,World w) { - return this; - } - }
\ No newline at end of file |