Capitalize/decapitalize only ASCII characters across project
Use {de,}capitalizeAsciiOnly and to{Lower,Upper}CaseAsciiOnly where
possible, and stdlib's functions with Locale.US everywhere else.
Otherwise, if the default system locale is Turkish, the capital latin
letter "I" is transformed in toLowerCase to "ı" (see
https://github.com/JetBrains/kotlin/blob/66bc142f92085047a1ca64f9a291f0496e33dd98/libraries/stdlib/jvm/test/text/StringJVMTest.kt#L119),
which for example breaks the codegen for `intArrayOf` in
KT-25400/KT-43405.
Similarly, lower case latin letter "i" is transformed to "İ".
#KT-13631 Fixed
#KT-25400 Fixed
#KT-43405 Fixed
This commit is contained in:
+3
-2
@@ -9,6 +9,7 @@ import com.sun.tools.javac.code.Symbol
|
||||
import org.jetbrains.kotlin.kapt3.base.util.KaptLogger
|
||||
import java.io.File
|
||||
import java.net.URI
|
||||
import java.util.*
|
||||
import javax.annotation.processing.Filer
|
||||
import javax.annotation.processing.ProcessingEnvironment
|
||||
import javax.annotation.processing.Processor
|
||||
@@ -49,7 +50,7 @@ class IncrementalProcessor(private val processor: Processor, private val kind: D
|
||||
if (fromOptions == null) {
|
||||
RuntimeProcType.NON_INCREMENTAL
|
||||
} else {
|
||||
val declaredType = fromOptions.drop("org.gradle.annotation.processing.".length).toUpperCase()
|
||||
val declaredType = fromOptions.drop("org.gradle.annotation.processing.".length).toUpperCase(Locale.US)
|
||||
if (ALLOWED_RUNTIME_TYPES.contains(declaredType)) {
|
||||
enumValueOf(declaredType)
|
||||
} else {
|
||||
@@ -251,4 +252,4 @@ enum class RuntimeProcType(val isIncremental: Boolean) {
|
||||
AGGREGATING(true),
|
||||
ISOLATING(true),
|
||||
NON_INCREMENTAL(false),
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.idea.configuration.GradleProjectImportHandler
|
||||
import org.jetbrains.kotlin.idea.facet.KotlinFacet
|
||||
import org.jetbrains.plugins.gradle.model.data.GradleSourceSetData
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
|
||||
class KaptGradleProjectImportHandler : GradleProjectImportHandler {
|
||||
override fun importBySourceSet(facet: KotlinFacet, sourceSetNode: DataNode<GradleSourceSetData>) {
|
||||
@@ -42,7 +43,7 @@ class KaptGradleProjectImportHandler : GradleProjectImportHandler {
|
||||
|
||||
private fun isKaptCompilerPluginPath(path: String): Boolean {
|
||||
val lastIndexOfFile = path.lastIndexOfAny(charArrayOf('/', File.separatorChar)).takeIf { it >= 0 } ?: return false
|
||||
val fileName = path.drop(lastIndexOfFile + 1).toLowerCase()
|
||||
val fileName = path.drop(lastIndexOfFile + 1).toLowerCase(Locale.US)
|
||||
return fileName.matches("kotlin\\-annotation\\-processing(\\-gradle)?\\-[0-9].*\\.jar".toRegex())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user