Fix minor compile warnings

This commit is contained in:
Dmitry Gridin
2019-04-17 17:48:26 +07:00
parent 79793a4bda
commit 37c856290f
226 changed files with 618 additions and 479 deletions
@@ -15,7 +15,6 @@ import org.jetbrains.kotlin.psi.KtScript
import kotlin.reflect.KClass
import kotlin.reflect.KType
import kotlin.script.experimental.dependencies.DependenciesResolver
import kotlin.script.experimental.location.ScriptExpectedLocation
import kotlin.script.templates.standard.ScriptTemplateWithArgs
open class KotlinScriptDefinition(open val template: KClass<out Any>) : UserDataHolderBase() {
@@ -48,8 +47,12 @@ open class KotlinScriptDefinition(open val template: KClass<out Any>) : UserData
@Deprecated("temporary workaround for missing functionality, will be replaced by the new API soon")
open val additionalCompilerArguments: Iterable<String>? = null
open val scriptExpectedLocations: List<ScriptExpectedLocation> =
listOf(ScriptExpectedLocation.SourcesOnly, ScriptExpectedLocation.TestsOnly)
@Suppress("DEPRECATION")
open val scriptExpectedLocations: List<kotlin.script.experimental.location.ScriptExpectedLocation> =
listOf(
kotlin.script.experimental.location.ScriptExpectedLocation.SourcesOnly,
kotlin.script.experimental.location.ScriptExpectedLocation.TestsOnly
)
open val implicitReceivers: List<KType> get() = emptyList()
@@ -57,7 +57,10 @@ abstract class KotlinScriptDefinitionAdapterFromNewAPIBase : KotlinScriptDefinit
override val acceptedAnnotations: List<KClass<out Annotation>> by lazy(LazyThreadSafetyMode.PUBLICATION) {
scriptCompilationConfiguration[ScriptCompilationConfiguration.refineConfigurationOnAnnotations]?.annotations
.orEmpty()
.map { getScriptingClass(it) as KClass<out Annotation> }
.map {
@Suppress("UNCHECKED_CAST")
getScriptingClass(it) as KClass<out Annotation>
}
}
override val implicitReceivers: List<KType> by lazy(LazyThreadSafetyMode.PUBLICATION) {
@@ -75,9 +78,10 @@ abstract class KotlinScriptDefinitionAdapterFromNewAPIBase : KotlinScriptDefinit
get() = scriptCompilationConfiguration[ScriptCompilationConfiguration.compilerOptions]
.orEmpty()
@Suppress("DEPRECATION")
override val scriptExpectedLocations: List<ScriptExpectedLocation>
get() = scriptCompilationConfiguration[ScriptCompilationConfiguration.ide.acceptedLocations]?.map {
when(it) {
when (it) {
ScriptAcceptedLocation.Sources -> ScriptExpectedLocation.SourcesOnly
ScriptAcceptedLocation.Tests -> ScriptExpectedLocation.TestsOnly
ScriptAcceptedLocation.Libraries -> ScriptExpectedLocation.Libraries
@@ -37,6 +37,7 @@ class ScriptContentLoader(private val project: Project) {
scriptDefinition.acceptedAnnotations.find { ann ->
psiAnn.typeName.let { it == ann.simpleName || it == ann.qualifiedName }
}?.let {
@Suppress("UNCHECKED_CAST")
constructAnnotation(
psiAnn,
classLoader.loadClass(it.qualifiedName).kotlin as KClass<out Annotation>,