[minor] scripting fixes in obsolete and test code...

relax acceptedAnnotations extraction rules for obsolete script template
handling code - the previous variant was failing on the typealias
comparison

also reduce warnings and possible exceptions on some test execution
paths
This commit is contained in:
Ilya Chernikov
2022-01-26 12:46:51 +01:00
committed by teamcity
parent 806bf8a735
commit 9d2cadc908
2 changed files with 3 additions and 3 deletions
@@ -91,7 +91,7 @@ open class KotlinScriptDefinitionFromAnnotatedTemplate(
left.parameters.size == right.parameters.size &&
left.parameters.zip(right.parameters).all {
it.first.kind == KParameter.Kind.INSTANCE ||
it.first.type == it.second.type
it.first.name == it.second.name
}
val resolveFunctions = getResolveFunctions()
@@ -363,7 +363,7 @@ class ScriptTemplateTest : TestCase() {
val rootDisposable = Disposer.newDisposable()
try {
val additionalClasspath = System.getProperty("kotlin.test.script.classpath")?.split(File.pathSeparator)
?.map { File(it) }.orEmpty().toTypedArray()
?.mapNotNull { File(it).takeIf { file -> file.exists() } }.orEmpty().toTypedArray()
val configuration = KotlinTestUtils.newConfiguration(
if (includeKotlinRuntime) ConfigurationKind.ALL else ConfigurationKind.JDK_ONLY,
TestJdkKind.FULL_JDK,
@@ -513,7 +513,7 @@ interface AcceptedAnnotationsCheck {
val actualAnnotations = scriptContents.annotations
Assert.assertTrue(
"Loaded annotation: $actualAnnotations",
actualAnnotations.single().annotationClass.qualifiedName == TestAnno1::class.qualifiedName
actualAnnotations.singleOrNull()?.annotationClass?.qualifiedName == TestAnno1::class.qualifiedName
)
return ScriptDependencies(