}
// the result
final Set<String> classes = new TreeSet<String>();
try {
final AnnotationFinder finder = new AnnotationFinder(archive);
finder.link();
//
// find classes
//
for (Profile profile : profileToUse) {
if (profile.getAnnotations() != null) {
for (String annotation : profile.getAnnotations()) {
final Class<? extends Annotation> annClazz;
try {
annClazz = (Class<? extends Annotation>) load(loader, annotation);
} catch (MojoFailureException mfe) {
getLog().warn("can't find " + annotation);
continue;
}
if (!useMeta) {
for (Class<?> clazz : finder.findAnnotatedClasses(annClazz)) {
classes.add(clazz.getName());
}
} else {
for (Annotated<Class<?>> clazz : finder.findMetaAnnotatedClasses(annClazz)) {
classes.add(clazz.get().getName());
}
}
if (!useMeta) {
for (Field clazz : finder.findAnnotatedFields(annClazz)) {
classes.add(clazz.getDeclaringClass().getName());
}
} else {
for (Annotated<Field> clazz : finder.findMetaAnnotatedFields(annClazz)) {
classes.add(clazz.get().getDeclaringClass().getName());
}
}
if (!useMeta) {
for (Method clazz : finder.findAnnotatedMethods(annClazz)) {
classes.add(clazz.getDeclaringClass().getName());
}
} else {
for (Annotated<Method> clazz : finder.findMetaAnnotatedMethods(annClazz)) {
classes.add(clazz.get().getDeclaringClass().getName());
}
}
}
}
if (profile.getSubclasses() != null) {
for (String subclass : profile.getSubclasses()) {
try {
for (Class<?> clazz : finder.findSubclasses(load(loader, subclass))) {
classes.add(clazz.getName());
}
} catch (MojoFailureException mfe) {
getLog().warn("can't find " + subclass);
}
}
}
if (profile.getImplementations() != null) {
for (String implementation : profile.getImplementations()) {
try {
for (Class<?> clazz : finder.findImplementations(load(loader, implementation))) {
classes.add(clazz.getName());
}
} catch (MojoFailureException mfe) {
getLog().warn("can't find " + implementation);
}