// match the argument type at argsIndex with the ExactAnnotationTypePattern
// we know it is exact because nothing else is allowed in args
ExactAnnotationTypePattern ap = (ExactAnnotationTypePattern)typePatterns[i];
- FuzzyBoolean matches = ap.matches(someArgs[argsIndex]);
+ FuzzyBoolean matches = ap.matchesRuntimeType(someArgs[argsIndex]);
if (matches == FuzzyBoolean.NO) {
return FuzzyBoolean.MAYBE; // could still match at runtime
} else {
"",IMessage.ERROR,shadow.getSourceLocation(),null,new ISourceLocation[]{getSourceLocation()});
}
if (ap.matches(rArgType).alwaysTrue()) { // !!! ASC Can we ever take this branch?
+ // !!! AMC - Yes, if annotation is @Inherited
argsIndex++;
continue;
} else {
}
return FuzzyBoolean.NO;
}
+
+ // this version should be called for @this, @target, @args
+ public FuzzyBoolean matchesRuntimeType(AnnotatedElement annotated) {
+ if (annotationType.hasAnnotation(TypeX.AT_INHERITED)) {
+ // a static match is good enough
+ if (matches(annotated).alwaysTrue()) {
+ return FuzzyBoolean.YES;
+ }
+ }
+ // a subtype could match at runtime
+ return FuzzyBoolean.MAYBE;
+ }
public void resolve(World world) {
ResolvedTypeX toMatchAgainst =
(isThis ? shadow.getThisType() : shadow.getTargetType() ).resolve(shadow.getIWorld());
annotationTypePattern.resolve(shadow.getIWorld());
- if (annotationTypePattern.matches(toMatchAgainst).alwaysTrue()) {
+ if (annotationTypePattern.matchesRuntimeType(toMatchAgainst).alwaysTrue()) {
return FuzzyBoolean.YES;
} else {
// a subtype may match at runtime