Migrate compiler, idea and others to new case conversion api
This commit is contained in:
+1
-1
@@ -70,7 +70,7 @@ abstract class AndroidLayoutXmlFileManager(val project: Project) {
|
||||
val resDirectories = variant.resDirectories.map { fileManager.findFileByUrl("file://$it") }
|
||||
val allChildren = resDirectories.flatMap { it?.getAllChildren() ?: listOf() }
|
||||
|
||||
val allLayoutFiles = allChildren.filter { it.parent.name.startsWith("layout") && it.name.toLowerCase().endsWith(".xml") }
|
||||
val allLayoutFiles = allChildren.filter { it.parent.name.startsWith("layout") && it.name.lowercase().endsWith(".xml") }
|
||||
val allLayoutPsiFiles = allLayoutFiles.fold(ArrayList<PsiFile>(allLayoutFiles.size)) { list, file ->
|
||||
val psiFile = psiManager.findFile(file)
|
||||
if (psiFile?.parent != null) {
|
||||
|
||||
+1
-1
@@ -45,7 +45,7 @@ class AllOpenMemberGenerator(session: FirSession) : FirDeclarationGenerationExte
|
||||
origin = FirDeclarationOrigin.Plugin(key)
|
||||
returnTypeRef = annotatedDeclaration.returnTypeRef
|
||||
status = annotatedDeclaration.status
|
||||
name = Name.identifier("hello${propertyName.capitalize()}")
|
||||
name = Name.identifier("hello${propertyName.replaceFirstChar(Char::uppercaseChar)}")
|
||||
symbol = FirNamedFunctionSymbol(CallableId(owner.classId, name))
|
||||
}
|
||||
return listOf(GeneratedDeclaration(function, owner))
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ private fun processSingleClasspathEntry(rootFile: File): Map<String, DeclaredPro
|
||||
for (line in text) {
|
||||
val parts = line.split(",")
|
||||
if (parts.size == 2) {
|
||||
val kind = parts[1].toUpperCase(Locale.ENGLISH)
|
||||
val kind = parts[1].uppercase()
|
||||
if (INCREMENTAL_DECLARED_TYPES.contains(kind)) {
|
||||
nameToType[parts[0]] = enumValueOf(kind)
|
||||
}
|
||||
|
||||
+1
-1
@@ -50,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(Locale.US)
|
||||
val declaredType = fromOptions.drop("org.gradle.annotation.processing.".length).uppercase()
|
||||
if (ALLOWED_RUNTIME_TYPES.contains(declaredType)) {
|
||||
enumValueOf(declaredType)
|
||||
} else {
|
||||
|
||||
@@ -36,7 +36,8 @@ class JavaKaptContextTest : TestCase() {
|
||||
val annotatedElements = roundEnv.getElementsAnnotatedWith(annotation)
|
||||
|
||||
for (annotatedElement in annotatedElements) {
|
||||
val generatedClassName = annotatedElement.simpleName.toString().capitalize() + annotationName.capitalize()
|
||||
val generatedClassName = annotatedElement.simpleName.toString().replaceFirstChar(Char::uppercaseChar) +
|
||||
annotationName.replaceFirstChar(Char::uppercaseChar)
|
||||
val file = processingEnv.filer.createSourceFile("generated." + generatedClassName)
|
||||
file.openWriter().use {
|
||||
it.write(
|
||||
|
||||
@@ -15,7 +15,7 @@ import java.nio.file.Files
|
||||
class KaptPathsTest : TestCase() {
|
||||
@Test
|
||||
fun testSymbolicLinks() {
|
||||
if (System.getProperty("os.name").toLowerCase().contains("win")) return
|
||||
if (System.getProperty("os.name").lowercase().contains("win")) return
|
||||
val tempDir = Files.createTempDirectory("kapt-test").toFile()
|
||||
try {
|
||||
fun File.writeJavaClass() = apply {
|
||||
|
||||
@@ -170,7 +170,7 @@ private fun argError(text: String): Nothing {
|
||||
|
||||
private fun findKaptCompilerPlugin(): File? {
|
||||
val pathToThisJar = File(PathUtil.getJarPathForClass(CliToolOption::class.java))
|
||||
if (pathToThisJar.extension.toLowerCase() != "jar") {
|
||||
if (pathToThisJar.extension.lowercase() != "jar") {
|
||||
return null
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -161,7 +161,7 @@ abstract class AbstractKotlinKapt3Test : KotlinKapt3TestBase() {
|
||||
)
|
||||
|
||||
val javaFiles = files
|
||||
.filter { it.name.toLowerCase().endsWith(".java") }
|
||||
.filter { it.name.lowercase().endsWith(".java") }
|
||||
.map { createTempFile(it.name.substringBeforeLast('.'), ".java", it.content) }
|
||||
|
||||
check(kaptContext, javaFiles, txtFile, wholeFile)
|
||||
@@ -294,7 +294,7 @@ open class AbstractClassFileToSourceStubConverterTest : AbstractKotlinKapt3Test(
|
||||
.map {
|
||||
// Unfortunately, we can't use the file name as it can contain temporary prefix
|
||||
val name = it.source?.name?.substringAfterLast("/") ?: ""
|
||||
val kind = when (name.substringAfterLast(".").toLowerCase()) {
|
||||
val kind = when (name.substringAfterLast(".").lowercase()) {
|
||||
"kt" -> "kotlin"
|
||||
"java" -> "java"
|
||||
else -> "other"
|
||||
|
||||
@@ -48,7 +48,7 @@ interface CustomJdkTestLauncher {
|
||||
val currentJavaHome = System.getProperty("java.home")
|
||||
|
||||
val classpath = collectClasspath(AbstractClassFileToSourceStubConverterTest::class.java.classLoader)
|
||||
.filter { it.protocol.toLowerCase() == "file" && it.path != null && !it.path.startsWith(currentJavaHome) }
|
||||
.filter { it.protocol.lowercase() == "file" && it.path != null && !it.path.startsWith(currentJavaHome) }
|
||||
.map { it.path }
|
||||
|
||||
val command = arrayOf(
|
||||
|
||||
+1
-1
@@ -43,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(Locale.US)
|
||||
val fileName = path.drop(lastIndexOfFile + 1).lowercase()
|
||||
return fileName.matches("kotlin\\-annotation\\-processing(\\-gradle)?\\-[0-9].*\\.jar".toRegex())
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -233,7 +233,7 @@ private class KJvmReplCompleter(
|
||||
getPresentation(
|
||||
it
|
||||
)
|
||||
Triple(it, presentation, (presentation.presentableText + presentation.tailText).toLowerCase())
|
||||
Triple(it, presentation, (presentation.presentableText + presentation.tailText).lowercase())
|
||||
}
|
||||
.let {
|
||||
if (isSortNeeded) it.sortedBy { descTriple -> descTriple.third } else it
|
||||
|
||||
Reference in New Issue
Block a user