diff --git a/.idea/dictionaries/Nikolay_Krasko.xml b/.idea/dictionaries/Nikolay_Krasko.xml index 45e56277729..0b5601b869b 100644 --- a/.idea/dictionaries/Nikolay_Krasko.xml +++ b/.idea/dictionaries/Nikolay_Krasko.xml @@ -2,6 +2,7 @@ accessors + codeowners coroutines crossinline fqname diff --git a/repo/codebase-tests/tests/org/jetbrains/kotlin/code/CodeConformanceTest.kt b/repo/codebase-tests/tests/org/jetbrains/kotlin/code/CodeConformanceTest.kt index 2e10fdd04c0..bd341f0e142 100644 --- a/repo/codebase-tests/tests/org/jetbrains/kotlin/code/CodeConformanceTest.kt +++ b/repo/codebase-tests/tests/org/jetbrains/kotlin/code/CodeConformanceTest.kt @@ -17,7 +17,8 @@ class CodeConformanceTest : TestCase() { companion object { private val JAVA_FILE_PATTERN = Pattern.compile(".+\\.java") private val SOURCES_FILE_PATTERN = Pattern.compile(".+\\.(java|kt|js)") - private const val MAX_STEPS_COUNT = 100 + + @Suppress("SpellCheckingInspection") private val nonSourcesMatcher = FileMatcher( File("."), listOf( @@ -74,6 +75,7 @@ class CodeConformanceTest : TestCase() { ) ) + @Suppress("SpellCheckingInspection") private val COPYRIGHT_EXCLUDED_FILES_AND_DIRS_MATCHER = FileMatcher( File("."), listOf( @@ -162,7 +164,7 @@ class CodeConformanceTest : TestCase() { val atAuthorPattern = Pattern.compile("/\\*.+@author.+\\*/", Pattern.DOTALL) - val tests = listOf( + @Suppress("SpellCheckingInspection") val tests = listOf( FileTestCase( "%d source files contain @author javadoc tag.\nPlease remove them or exclude in this test:\n%s" ) { _, source -> @@ -394,7 +396,7 @@ class CodeConformanceTest : TestCase() { ) ) - data class RepoOccurance(val repo: String, val file: File) + data class RepoOccurrence(val repo: String, val file: File) data class RepoOccurrences(val repo: String, val files: Collection) val extensionsPattern = Pattern.compile(".+\\.(java|kt|gradle|kts|xml)(\\.\\w+)?") @@ -405,12 +407,12 @@ class CodeConformanceTest : TestCase() { } if (checkers.isNotEmpty()) { - val occurrences = ArrayList() + val occurrences = ArrayList() file.useLines { lines -> for (line in lines) { for (checker in checkers) { if (line.contains(checker.repo) && (checker.exclude == null || !line.contains(checker.exclude))) { - occurrences.add(RepoOccurance(checker.repo, file)) + occurrences.add(RepoOccurrence(checker.repo, file)) } } } diff --git a/repo/codebase-tests/tests/org/jetbrains/kotlin/code/DepsVerificationMetadataTest.kt b/repo/codebase-tests/tests/org/jetbrains/kotlin/code/DependenciesVerificationMetadataTest.kt similarity index 98% rename from repo/codebase-tests/tests/org/jetbrains/kotlin/code/DepsVerificationMetadataTest.kt rename to repo/codebase-tests/tests/org/jetbrains/kotlin/code/DependenciesVerificationMetadataTest.kt index ec27b6b20e0..a92348b2d29 100644 --- a/repo/codebase-tests/tests/org/jetbrains/kotlin/code/DepsVerificationMetadataTest.kt +++ b/repo/codebase-tests/tests/org/jetbrains/kotlin/code/DependenciesVerificationMetadataTest.kt @@ -17,7 +17,7 @@ import org.junit.Test import java.io.File -class DepsVerificationMetadataTest { +class DependenciesVerificationMetadataTest { @JacksonXmlRootElement(localName = "verification-metadata") private data class VerificationMetadata( @field:JacksonXmlElementWrapper(localName = "components") diff --git a/repo/codebase-tests/tests/org/jetbrains/kotlin/code/ReflectionCodeSanityTest.kt b/repo/codebase-tests/tests/org/jetbrains/kotlin/code/ReflectionCodeSanityTest.kt index ca0c831a9c3..7603cb82b2d 100644 --- a/repo/codebase-tests/tests/org/jetbrains/kotlin/code/ReflectionCodeSanityTest.kt +++ b/repo/codebase-tests/tests/org/jetbrains/kotlin/code/ReflectionCodeSanityTest.kt @@ -27,7 +27,7 @@ class ReflectionCodeSanityTest : TestCase() { } private fun loadClass(name: String): Class<*> = - classLoader.loadClass("kotlin.reflect.jvm.internal.$name") + classLoader.loadClass("kotlin.reflect.jvm.internal.$name") private fun collectClassesWithSupers(vararg names: String): Set> { val result = linkedSetOf>() @@ -47,41 +47,43 @@ class ReflectionCodeSanityTest : TestCase() { fun testNoDelegatedPropertiesInKClassAndKProperties() { val badMembers = linkedSetOf() for (klass in collectClassesWithSupers( - "KClassImpl", - "KMutableProperty0Impl", - "KMutableProperty1Impl", - "KMutableProperty2Impl" + "KClassImpl", + "KMutableProperty0Impl", + "KMutableProperty1Impl", + "KMutableProperty2Impl" )) { badMembers.addAll(klass.declaredFields.filter { it.name.endsWith(JvmAbi.DELEGATED_PROPERTY_NAME_SUFFIX) }) badMembers.addAll(klass.declaredMethods.filter { it.name.endsWith(JvmAbi.DELEGATED_PROPERTY_NAME_SUFFIX) }) } if (badMembers.isNotEmpty()) { - fail("The members listed below appear to be delegates for properties.\n" + - "It's highly not recommended to use property delegates in reflection.jvm because a KProperty instance\n" + - "is created for each delegated property and that makes the initialization sequence of reflection\n" + - "implementation classes unpredictable and leads to a deadlock or ExceptionInInitializerError.\n\n" + - "Please un-delegate the corresponding properties:\n\n" + - badMembers.joinToString("\n")) + fail( + "The members listed below appear to be delegates for properties.\n" + + "It's highly not recommended to use property delegates in reflection.jvm because a KProperty instance\n" + + "is created for each delegated property and that makes the initialization sequence of reflection\n" + + "implementation classes unpredictable and leads to a deadlock or ExceptionInInitializerError.\n\n" + + "Please un-delegate the corresponding properties:\n\n" + + badMembers.joinToString("\n") + ) } } fun testMaxAllowedFields() { - // The following classes are instantiated a lot in Kotlin applications and thus they should be optimized as best as possible. + // The following classes are instantiated a lot in Kotlin applications, and thus they should be optimized as good as possible. // This test checks that these classes have not more fields than a predefined small number, which can usually be calculated as // the number of constructor parameters (number of objects needed to initialize an instance) + 1 for 'data', the reflection cache. val classesWithMaxAllowedFields = linkedMapOf( - "KClassImpl" to 2, // jClass, data - "KPackageImpl" to 3 // jClass, moduleName, data + "KClassImpl" to 2, // jClass, data + "KPackageImpl" to 3 // jClass, moduleName, data ) val badClasses = linkedMapOf, Collection>() for ((className, maxAllowedFields) in classesWithMaxAllowedFields) { val klass = loadClass(className) val fields = generateSequence(klass) { it.superclass } - .flatMap { it.declaredFields.asSequence() } - .filterNot { Modifier.isStatic(it.modifiers) } - .toList() + .flatMap { it.declaredFields.asSequence() } + .filterNot { Modifier.isStatic(it.modifiers) } + .toList() if (fields.size > maxAllowedFields) { badClasses[klass] = fields } @@ -89,11 +91,11 @@ class ReflectionCodeSanityTest : TestCase() { if (badClasses.isNotEmpty()) { fail("Some classes in reflection.jvm contain more fields than it is allowed. Please optimize storage in these classes:\n\n" + - badClasses.entries.joinToString("\n") { entry -> - val (klass, fields) = entry - "$klass has ${fields.size} fields but max allowed = ${classesWithMaxAllowedFields[klass.simpleName]}:\n" + - fields.joinToString("\n") { " $it" } - }) + badClasses.entries.joinToString("\n") { entry -> + val (klass, fields) = entry + "$klass has ${fields.size} fields but max allowed = ${classesWithMaxAllowedFields[klass.simpleName]}:\n" + + fields.joinToString("\n") { " $it" } + }) } } } diff --git a/repo/codebase-tests/tests/org/jetbrains/kotlin/code/SpaceCodeOwnersTest.kt b/repo/codebase-tests/tests/org/jetbrains/kotlin/code/SpaceCodeOwnersTest.kt index b564b448d7e..425b180ca31 100644 --- a/repo/codebase-tests/tests/org/jetbrains/kotlin/code/SpaceCodeOwnersTest.kt +++ b/repo/codebase-tests/tests/org/jetbrains/kotlin/code/SpaceCodeOwnersTest.kt @@ -120,7 +120,7 @@ class SpaceCodeOwnersTest : TestCase() { // (line = 5, pattern = /some/), // (line = 1, pattern = *) // With input of parent = (line = 5, pattern = /some/) and path = /some/other - // we only search till our parent pattern line, as other rules has lower specifity + // we only search till our parent pattern line, as other rules are less specific for (use in this) { if (parentMatchLine != null && use.item.line < parentMatchLine) break if (use.rule.isMatch(path, isDirectory)) {