Properly close ClassGraph scan

This commit is contained in:
Mike Cifelli 2018-10-21 08:50:56 -04:00
parent 0695ddc1f2
commit c7b9f694c7
1 changed files with 2 additions and 2 deletions

View File

@ -14,8 +14,8 @@ object FunctionTable {
.enableAnnotationInfo() .enableAnnotationInfo()
.whitelistPackages("function.builtin") .whitelistPackages("function.builtin")
private val allBuiltIns = with(classGraph.scan()) { private val allBuiltIns = classGraph.scan().use { scan ->
getClassesWithAnnotation(FunctionNames::class.qualifiedName) scan.getClassesWithAnnotation(FunctionNames::class.qualifiedName)
.map { it.loadClass() } .map { it.loadClass() }
.filterIsInstance<Class<out LispFunction>>() .filterIsInstance<Class<out LispFunction>>()
.toSet() .toSet()