From ec2dfa898b4cf2613ca15cd959a43f4f590005d3 Mon Sep 17 00:00:00 2001 From: Xerus <27jf@web.de> Date: Thu, 13 Dec 2018 17:45:46 +0100 Subject: Fix IDEA Inspections --- core/src/main/kotlin/Utilities/DokkaModules.kt | 6 ++---- core/src/main/kotlin/Utilities/ServiceLocator.kt | 4 +--- 2 files changed, 3 insertions(+), 7 deletions(-) (limited to 'core/src/main/kotlin/Utilities') 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 Binder.lazyBind(): Lazy> inline infix fun > Lazy>.toOptional(kClass: TKClass?) = kClass?.let { value toType it } -inline infix fun > AnnotatedBindingBuilder.toType(kClass: TKClass) = to(kClass.java) +inline infix fun > AnnotatedBindingBuilder.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 lookup(clazz: Class, 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) -- cgit