in TransformCore/src/main/java/com/facebook/ads/injkit/AnnotationProcessorImpl.java [80:113]
private void updateModelWithBaseClasspathElements()
throws IOException, AnnotationProcessingException {
List<ClassLoader> ldrs = new ArrayList<>();
for (ClassLoader ldr = AnnotationProcessorImpl.class.getClassLoader();
ldr != null;
ldr = ldr.getParent()) {
ldrs.add(ldr);
}
// Process the loaders in inverse order to be more likely consistent with class precedence.
Collections.reverse(ldrs);
List<File> files = new ArrayList<>();
for (ClassLoader ldr : ldrs) {
if (ldr instanceof URLClassLoader) {
URL[] urls = ((URLClassLoader) ldr).getURLs();
for (URL url : urls) {
if ("file".equals(url.getProtocol()) || url.getProtocol() == null) {
File file = new File(URLDecoder.decode(url.getFile(), Charset.defaultCharset().name()));
addRecursive(file, files);
}
}
} else {
for (String path : Splitter.on(PATH_SEPARATOR.value()).split(JAVA_CLASS_PATH.value())) {
if (!path.endsWith(".jar")) {
continue;
}
File file = new File(path);
addRecursive(file, files);
}
}
}
updateModel(files);
}