use of org.apache.felix.scrplugin.Source in project felix by apache.
the class ClassScanner method scanSources.
/**
* Scan all source class files for annotations and process them.
*/
public List<ClassDescription> scanSources() throws SCRDescriptorFailureException, SCRDescriptorException {
final List<ClassDescription> result = new ArrayList<ClassDescription>();
for (final Source src : project.getSources()) {
if (src.getFile().getName().equals("package-info.java")) {
log.debug("Skipping file " + src.getClassName());
continue;
}
log.debug("Scanning class " + src.getClassName());
try {
// load the class
final Class<?> annotatedClass = project.getClassLoader().loadClass(src.getClassName());
this.process(annotatedClass, src, result);
} catch (final SCRDescriptorFailureException e) {
throw e;
} catch (final SCRDescriptorException e) {
throw e;
} catch (final ClassNotFoundException e) {
log.warn("ClassNotFoundException: " + e.getMessage());
} catch (final NoClassDefFoundError e) {
log.warn("NoClassDefFoundError: " + e.getMessage());
} catch (final Throwable t) {
throw new SCRDescriptorException("Unable to load compiled class: " + src.getClassName(), src.getFile().toString(), t);
}
}
return result;
}
Aggregations