// aload annotationClass
int annClassIndex = fact.getConstantPool().addClass(hasAnnotation.getAnnotationType().getSignature());
il.append(new LDC_W(annClassIndex));
- Member isAnnotationPresent = Member.method(TypeX.forName("Ljava/lang/Class"),0,
+ Member isAnnotationPresent = Member.method(TypeX.forName("java/lang/Class"),0,
"isAnnotationPresent","(Ljava/lang/Class;)Z");
il.append(Utility.createInvoke(fact,world,isAnnotationPresent));
il.append(createJumpBasedOnBooleanOnStack());
// we can attempt to match now
ResolvedTypeX toMatchAgainst =
(isThis ? shadow.getThisType() : shadow.getTargetType() ).resolve(shadow.getIWorld());
- return FuzzyBoolean.fromBoolean(toMatchAgainst.hasAnnotation(annotationType));
+ if (toMatchAgainst.hasAnnotation(annotationType)) {
+ return FuzzyBoolean.YES;
+ } else {
+ ResolvedTypeX superC = toMatchAgainst;
+ while ((superC = superC.getSuperclass()) != null) {
+ if (superC.hasAnnotation(annotationType)) return FuzzyBoolean.YES;
+// if (superC.getName().equals("java.lang.Object")) return FuzzyBoolean.NO;
+ }
+ return FuzzyBoolean.NO;
+ }
}
// else we can only do matching via a runtime test
return FuzzyBoolean.MAYBE;