aboutsummaryrefslogtreecommitdiff
path: root/src/Utilities
diff options
context:
space:
mode:
authorDmitry Jemerov <yole@jetbrains.com>2015-11-05 12:09:42 +0100
committerDmitry Jemerov <yole@jetbrains.com>2015-11-05 12:09:42 +0100
commitd2c8b670bf13615aa91df2d39b252f3ba7c38837 (patch)
tree6a7ebdd2ad36c2cfcf4b45d6586837e1a167a820 /src/Utilities
parent01fa0383002212045ebf3ea1a8751b03b4513353 (diff)
downloaddokka-d2c8b670bf13615aa91df2d39b252f3ba7c38837.tar.gz
dokka-d2c8b670bf13615aa91df2d39b252f3ba7c38837.tar.bz2
dokka-d2c8b670bf13615aa91df2d39b252f3ba7c38837.zip
remove unnecessary getResourceAsStream() (https://bugs.openjdk.java.net/browse/JDK-8080094)
Diffstat (limited to 'src/Utilities')
-rw-r--r--src/Utilities/ServiceLocator.kt6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Utilities/ServiceLocator.kt b/src/Utilities/ServiceLocator.kt
index 92aa9ba4..7a5aff79 100644
--- a/src/Utilities/ServiceLocator.kt
+++ b/src/Utilities/ServiceLocator.kt
@@ -40,10 +40,10 @@ public object ServiceLocator {
return ServiceDescriptor(implementationName, category, properties["description"]?.toString(), className)
}
- fun allServices(category: String): List<ServiceDescriptor> = javaClass.classLoader.getResourceAsStream("dokka/$category")?.use { stream ->
+ fun allServices(category: String): List<ServiceDescriptor> {
val entries = this.javaClass.classLoader.getResources("dokka/$category")?.toList() ?: emptyList()
- entries.flatMap {
+ return entries.flatMap {
when (it.protocol) {
"file" -> File(it.file).listFiles()?.filter { it.extension == "properties" }?.map { lookupDescriptor(category, it.nameWithoutExtension) } ?: emptyList()
"jar" -> {
@@ -63,7 +63,7 @@ public object ServiceLocator {
else -> emptyList<ServiceDescriptor>()
}
}
- } ?: emptyList()
+ }
}
public inline fun <reified T : Any> ServiceLocator.lookup(category: String, implementationName: String): T = lookup(T::class.java, category, implementationName)