fun load()

in crumb-core/src/main/kotlin/com/uber/crumb/core/CrumbManager.kt [42:59]


  fun load(packageName: String): Set<BufferedSource> {
    // If this package is null, it means there are no classes with this package name. One way this
    // could happen is if we process an annotation and reach this point without writing something
    // to the package. We do not error check here because that shouldn't happen with the
    // current implementation.
    val crumbGenPackage: PackageElement? = env.elementUtils.getPackageElement(packageName)

    if (crumbGenPackage == null) {
      crumbLog.e("No @CrumbIndex-annotated elements found in $packageName")
      return emptySet()
    }

    return crumbGenPackage.enclosedElements.mapNotNullTo(mutableSetOf()) { element ->
      element.getAnnotation(CrumbIndex::class.java)?.run {
        Buffer().apply { write(value) }
      }
    }
  }