in src/scala/io/bazel/rules_scala/jmh_support/BenchmarkGenerator.scala [185:206]
private def classByPath(path: Path, cl: ClassLoader): Option[Class[_]] = {
val separator = path.getFileSystem.getSeparator
var s = path.toString
.stripPrefix(separator)
.stripSuffix(".class")
.replace(separator, ".")
var index = -1
do {
s = s.substring(index + 1)
try {
return Some(Class.forName(s, false, cl))
} catch {
case _: ClassNotFoundException =>
// ignore and try next one
index = s.indexOf('.')
}
} while (index != -1)
log(s"Failed to find class for path $path")
None
}