private static void scanFile(Collection<String> classes, Pattern regex, Class<? extends Annotation>[] annotated, Predicate<InputStream> bytecodeFilter, String relName, File file, ZipFile zip, ZipEntry entry, AtomicInteger searched) { Log.trace("scanned file", "file", relName); if (relName.endsWith(".class")) { searched.incrementAndGet(); String clsName = Str.sub(relName, 0, -6).replace('/', '.').replace('\\', '.'); if (U.isEmpty(regex) || regex.matcher(clsName).matches()) { try { InputStream input = file != null ? new FileInputStream(file) : zip.getInputStream(entry); boolean include; if (U.isEmpty(annotated)) { include = true; } else { ClassFile classFile = new ClassFile(new DataInputStream(input)); include = isAnnotated(classFile, annotated); } if (include && bytecodeFilter != null) { include = Lmbd.eval(bytecodeFilter, input); } if (include) { classes.add(clsName); } } catch (Throwable e) { Log.debug("Error while loading class", "name", clsName, "error", e); } } } }