diff options
author | Xerus <27jf@web.de> | 2018-12-13 17:45:46 +0100 |
---|---|---|
committer | Xerus <27jf@web.de> | 2018-12-13 17:45:46 +0100 |
commit | ec2dfa898b4cf2613ca15cd959a43f4f590005d3 (patch) | |
tree | 05d830e360633b36d580ce2759c83070e3c51bed /core/src/main/kotlin/Utilities | |
parent | 17dd9747828a2ba8275714dc421a415c68d01615 (diff) | |
download | dokka-ec2dfa898b4cf2613ca15cd959a43f4f590005d3.tar.gz dokka-ec2dfa898b4cf2613ca15cd959a43f4f590005d3.tar.bz2 dokka-ec2dfa898b4cf2613ca15cd959a43f4f590005d3.zip |
Fix IDEA Inspections
Diffstat (limited to 'core/src/main/kotlin/Utilities')
-rw-r--r-- | core/src/main/kotlin/Utilities/DokkaModules.kt | 6 | ||||
-rw-r--r-- | core/src/main/kotlin/Utilities/ServiceLocator.kt | 4 |
2 files changed, 3 insertions, 7 deletions
diff --git a/core/src/main/kotlin/Utilities/DokkaModules.kt b/core/src/main/kotlin/Utilities/DokkaModules.kt index 36704918..cead29c9 100644 --- a/core/src/main/kotlin/Utilities/DokkaModules.kt +++ b/core/src/main/kotlin/Utilities/DokkaModules.kt @@ -2,14 +2,12 @@ package org.jetbrains.dokka.Utilities import com.google.inject.Binder import com.google.inject.Module -import com.google.inject.Provider import com.google.inject.TypeLiteral import com.google.inject.binder.AnnotatedBindingBuilder +import com.google.inject.binder.ScopedBindingBuilder import com.google.inject.name.Names import org.jetbrains.dokka.* import org.jetbrains.dokka.Formats.FormatDescriptor -import org.jetbrains.dokka.Model.DescriptorSignatureProvider -import org.jetbrains.dokka.Samples.SampleProcessingService import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment import java.io.File import kotlin.reflect.KClass @@ -77,4 +75,4 @@ inline fun <reified T: Any> Binder.lazyBind(): Lazy<AnnotatedBindingBuilder<T>> inline infix fun <reified T: Any, TKClass: KClass<out T>> Lazy<AnnotatedBindingBuilder<T>>.toOptional(kClass: TKClass?) = kClass?.let { value toType it } -inline infix fun <reified T: Any, TKClass: KClass<out T>> AnnotatedBindingBuilder<T>.toType(kClass: TKClass) = to(kClass.java) +inline infix fun <reified T: Any, TKClass: KClass<out T>> AnnotatedBindingBuilder<T>.toType(kClass: TKClass): ScopedBindingBuilder = to(kClass.java) diff --git a/core/src/main/kotlin/Utilities/ServiceLocator.kt b/core/src/main/kotlin/Utilities/ServiceLocator.kt index 71bfd21b..6f2ebd0f 100644 --- a/core/src/main/kotlin/Utilities/ServiceLocator.kt +++ b/core/src/main/kotlin/Utilities/ServiceLocator.kt @@ -15,9 +15,7 @@ object ServiceLocator { fun <T : Any> lookup(clazz: Class<T>, category: String, implementationName: String): T { val descriptor = lookupDescriptor(category, implementationName) val loadedClass = javaClass.classLoader.loadClass(descriptor.className) - val constructor = loadedClass.constructors - .filter { it.parameterTypes.isEmpty() } - .firstOrNull() ?: throw ServiceLookupException("Class ${descriptor.className} has no corresponding constructor") + val constructor = loadedClass.constructors.firstOrNull { it.parameterTypes.isEmpty() } ?: throw ServiceLookupException("Class ${descriptor.className} has no corresponding constructor") val implementationRawType: Any = if (constructor.parameterTypes.isEmpty()) constructor.newInstance() else constructor.newInstance(constructor) |