[Test] Run fir diagnostics tests with light tree in sequential mode
In parallel mode many tests are failing so it's temporary workaround
This commit is contained in:
committed by
TeamCityServer
parent
2f1e4862e5
commit
e742af5444
+21
-1
@@ -5,14 +5,34 @@
|
||||
|
||||
package org.jetbrains.kotlin.generators.model
|
||||
|
||||
import org.jetbrains.kotlin.generators.util.isDefaultImportedClass
|
||||
import org.jetbrains.kotlin.utils.Printer
|
||||
import kotlin.reflect.KClass
|
||||
|
||||
class AnnotationModel(
|
||||
val annotation: Class<out Annotation>,
|
||||
val arguments: List<Any>
|
||||
) {
|
||||
fun generate(p: Printer) {
|
||||
val argumentsString = arguments.joinToString(separator = ",") { "\"$it\""}
|
||||
val argumentsString = arguments.joinToString(separator = ",") {
|
||||
when (it) {
|
||||
is Enum<*> -> "${it.javaClass.simpleName}.${it.name}"
|
||||
is Class<*> -> "${it.simpleName::class.java}.class"
|
||||
else -> "\"$it\""
|
||||
}
|
||||
}
|
||||
p.print("@${annotation.simpleName}($argumentsString)")
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalStdlibApi::class)
|
||||
fun imports(): List<Class<*>> {
|
||||
return buildList {
|
||||
add(annotation)
|
||||
arguments.mapTo(this) { it.javaClass }
|
||||
}.filterNot { it.isDefaultImportedClass() }
|
||||
}
|
||||
}
|
||||
|
||||
fun annotation(annotation: Class<out Annotation>, vararg arguments: Any): AnnotationModel {
|
||||
return AnnotationModel(annotation, arguments.toList())
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ abstract class TestClassModel : ClassModel {
|
||||
override val imports: Set<Class<*>>
|
||||
get() {
|
||||
return mutableSetOf<Class<*>>().also { allImports ->
|
||||
annotations.mapTo(allImports) { it.annotation }
|
||||
annotations.flatMapTo(allImports) { it.imports() }
|
||||
methods.flatMapTo(allImports) { it.imports() }
|
||||
innerTestClasses.flatMapTo(allImports) { it.imports }
|
||||
}
|
||||
|
||||
+12
@@ -34,3 +34,15 @@ object TestGeneratorUtil {
|
||||
return escapeForJavaIdentifier(file.name).capitalize()
|
||||
}
|
||||
}
|
||||
|
||||
private val defaultPackages = listOf(
|
||||
"java.lang",
|
||||
"kotlin",
|
||||
"kotlin.annotations",
|
||||
"kotlin.collections"
|
||||
)
|
||||
|
||||
fun Class<*>.isDefaultImportedClass(): Boolean {
|
||||
val outerName = canonicalName.removeSuffix(".$simpleName")
|
||||
return outerName in defaultPackages
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user