[minor] Drop some usages of kotlin reflection in scripting compiler plugin

This commit is contained in:
Ilya Chernikov
2019-09-11 14:13:37 +02:00
parent 689a5cbdf5
commit f8db150a2b
7 changed files with 10 additions and 10 deletions
@@ -16,7 +16,6 @@ dependencies {
compile(project(":kotlin-scripting-jvm"))
compile(project(":kotlin-scripting-compiler-impl"))
compile(kotlinStdlib())
compileOnly(project(":kotlin-reflect-api"))
compileOnly(intellijCoreDep()) { includeJars("intellij-core") }
testCompile(project(":compiler:frontend"))
@@ -6,13 +6,14 @@
package org.jetbrains.kotlin.scripting.compiler.plugin.impl
import org.jetbrains.kotlin.cli.common.arguments.Argument
import org.jetbrains.kotlin.cli.common.arguments.ArgumentParseErrors
import org.jetbrains.kotlin.cli.common.arguments.K2JVMCompilerArguments
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageLocation
import org.jetbrains.kotlin.cli.common.messages.CompilerMessageSeverity
import org.jetbrains.kotlin.cli.common.messages.MessageCollector
import org.jetbrains.kotlin.scripting.definitions.MessageReporter
import org.jetbrains.kotlin.utils.addToStdlib.firstIsInstanceOrNull
import kotlin.reflect.KMutableProperty1
import kotlin.reflect.full.findAnnotation
import kotlin.script.experimental.api.ResultWithDiagnostics
import kotlin.script.experimental.api.ScriptDiagnostic
import kotlin.script.experimental.api.SourceCode
@@ -136,7 +137,7 @@ private fun reportIgnoredArguments(
) {
val ignoredArgKeys = toIgnore.mapNotNull { argProperty ->
if (argProperty.get(arguments) != argProperty.get(reportingState.currentArguments)) {
argProperty.findAnnotation<Argument>()?.value
argProperty.annotations.firstIsInstanceOrNull<Argument>()?.value
?: throw IllegalStateException("unknown compiler argument property: $argProperty: no Argument annotation found")
} else null
}