Migrate compiler, idea and others to new case conversion api
This commit is contained in:
@@ -188,7 +188,7 @@ private fun CallableDescriptor.getParametersTypes(): List<KotlinType> =
|
||||
listOf((containingDeclaration as ClassDescriptor).defaultType) +
|
||||
valueParameters.map { it.type.makeNotNullable() }
|
||||
|
||||
private fun KotlinType.asString(): String = typeName.toUpperCase()
|
||||
private fun KotlinType.asString(): String = typeName.uppercase()
|
||||
|
||||
private val KotlinType.typeName: String
|
||||
get(): String = constructor.declarationDescriptor!!.name.asString()
|
||||
|
||||
+2
-2
@@ -46,10 +46,10 @@ open class SimpleTestMethodModel(
|
||||
extractedName
|
||||
} else {
|
||||
val relativePath = FileUtil.getRelativePath(rootDir, file.parentFile)
|
||||
relativePath + "-" + extractedName.capitalize()
|
||||
relativePath + "-" + extractedName.replaceFirstChar(Char::uppercaseChar)
|
||||
}
|
||||
val ignored = skipIgnored && InTextDirectivesUtils.isIgnoredTarget(targetBackend, file)
|
||||
return (if (ignored) "ignore" else "test") + escapeForJavaIdentifier(unescapedName).capitalize()
|
||||
return (if (ignored) "ignore" else "test") + escapeForJavaIdentifier(unescapedName).replaceFirstChar(Char::uppercaseChar)
|
||||
}
|
||||
|
||||
init {
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ object TestGeneratorUtil {
|
||||
|
||||
@JvmStatic
|
||||
fun fileNameToJavaIdentifier(file: File): String {
|
||||
return escapeForJavaIdentifier(file.name).capitalize()
|
||||
return escapeForJavaIdentifier(file.name).replaceFirstChar(Char::uppercaseChar)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
-6
@@ -89,7 +89,7 @@ class GenerateProtoBufCompare {
|
||||
}
|
||||
return (extensionPrefix + fieldDescriptor.name.javaName + (if (fieldDescriptor.isRepeated) "List" else ""))
|
||||
.replace("[A-Z]".toRegex()) { "_" + it.value }
|
||||
.toUpperCase()
|
||||
.uppercase()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,7 +236,7 @@ class GenerateProtoBufCompare {
|
||||
|
||||
fun generateHashCodeForField(field: Descriptors.FieldDescriptor, p: Printer, isExtensionField: Boolean) {
|
||||
val fieldName = field.name.javaName
|
||||
val capFieldName = fieldName.capitalize()
|
||||
val capFieldName = fieldName.replaceFirstChar(Char::uppercaseChar)
|
||||
val outerClassName = field.file.options.javaOuterClassname.removePrefix("Debug")
|
||||
val fullFieldName = "$outerClassName.$fieldName"
|
||||
|
||||
@@ -310,7 +310,7 @@ class GenerateProtoBufCompare {
|
||||
|
||||
val typeName = field.containingType.typeName
|
||||
val fieldName = field.name.javaName
|
||||
val capFieldName = fieldName.capitalize()
|
||||
val capFieldName = fieldName.replaceFirstChar(Char::uppercaseChar)
|
||||
val methodName = field.helperMethodName()
|
||||
|
||||
p.println()
|
||||
@@ -357,7 +357,7 @@ class GenerateProtoBufCompare {
|
||||
|
||||
open inner class FieldGeneratorImpl(field: Descriptors.FieldDescriptor, p: Printer) : FieldGenerator(field, p) {
|
||||
val fieldName = field.name.javaName
|
||||
val capFieldName = fieldName.capitalize()
|
||||
val capFieldName = fieldName.replaceFirstChar(Char::uppercaseChar)
|
||||
|
||||
override fun printRepeatedField() {
|
||||
repeatedFields.add(field)
|
||||
@@ -496,12 +496,12 @@ class GenerateProtoBufCompare {
|
||||
val packageHeader = this.file.`package`
|
||||
val descriptor = this.containingType
|
||||
val className = descriptor.fullName.removePrefix(packageHeader).replace(".", "")
|
||||
val capFieldName = this.name.javaName.capitalize()
|
||||
val capFieldName = this.name.javaName.replaceFirstChar(Char::uppercaseChar)
|
||||
return "$CHECK_EQUALS_NAME$className$capFieldName"
|
||||
}
|
||||
|
||||
private val String.javaName: String
|
||||
get() = this.split("_").joinToString("") { it.capitalize() }.decapitalize()
|
||||
get() = this.split("_").joinToString("") { it.replaceFirstChar(Char::uppercaseChar) }.replaceFirstChar(Char::lowercaseChar)
|
||||
}
|
||||
|
||||
private fun Printer.printlnMultiline(string: String) {
|
||||
|
||||
Reference in New Issue
Block a user