* @return true if so
*/
public boolean isAnnotationStyleAspect(String name, byte[] bytes) {
try {
ClassParser cp = new ClassParser(new ByteArrayInputStream(bytes), null);
JavaClass jc = cp.parse();
if (!jc.isClass()) {
return false;
}
Annotation anns[] = jc.getAnnotations();
if (anns.length == 0) {
return false;
}
boolean couldBeAtAspectJStyle = false;
for (int i = 0; i < anns.length; i++) {
Annotation ann = anns[i];
if ("Lorg/aspectj/lang/annotation/Aspect;".equals(ann.getTypeSignature())) {
couldBeAtAspectJStyle = true;
}
}
if (!couldBeAtAspectJStyle) return false;
// ok, so it has the annotation, but it could have been put
// on a code style aspect by the annotation visitor
Attribute[] attributes = jc.getAttributes();
for (int i = 0; i < attributes.length; i++) {
if (attributes[i].getName().equals(Aspect.AttributeName)) {
return false;
}
}