Migrate compiler, idea and others to new case conversion api
This commit is contained in:
+2
-2
@@ -262,7 +262,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
|
||||
private fun getFlavorUnitTestFolder(flavourName: String): String {
|
||||
return pathManager.srcFolderInAndroidTmpFolder +
|
||||
"/androidTest${flavourName.capitalize()}/java/" +
|
||||
"/androidTest${flavourName.replaceFirstChar(Char::uppercaseChar)}/java/" +
|
||||
testClassPackage.replace(".", "/") + "/"
|
||||
}
|
||||
|
||||
@@ -379,7 +379,7 @@ class CodegenTestsOnAndroidGenerator private constructor(private val pathManager
|
||||
configure(backend)
|
||||
testInfo = KotlinTestInfo(
|
||||
"org.jetbrains.kotlin.android.tests.AndroidRunner",
|
||||
"test${testDataFile.nameWithoutExtension.capitalize()}",
|
||||
"test${testDataFile.nameWithoutExtension.replaceFirstChar(Char::uppercaseChar)}",
|
||||
emptySet()
|
||||
)
|
||||
}.build(testDataFile.path)
|
||||
|
||||
+2
-2
@@ -27,7 +27,7 @@ class UnitTestFileWriter(
|
||||
}
|
||||
|
||||
fun generate() {
|
||||
FileWriter(File(flavourFolder, flavourName.capitalize() + ".java").also { it.parentFile.mkdirs() }).use { suite ->
|
||||
FileWriter(File(flavourFolder, flavourName.replaceFirstChar(Char::uppercaseChar) + ".java").also { it.parentFile.mkdirs() }).use { suite ->
|
||||
val p = Printer(suite)
|
||||
p.println(
|
||||
"""package ${CodegenTestsOnAndroidGenerator.testClassPackage};
|
||||
@@ -35,7 +35,7 @@ class UnitTestFileWriter(
|
||||
|import ${CodegenTestsOnAndroidGenerator.baseTestClassPackage}.${CodegenTestsOnAndroidGenerator.baseTestClassName};
|
||||
|
|
||||
|/* This class is generated by ${CodegenTestsOnAndroidGenerator.generatorName}. DO NOT MODIFY MANUALLY */
|
||||
|public class ${flavourName.capitalize()} extends ${CodegenTestsOnAndroidGenerator.baseTestClassName} {
|
||||
|public class ${flavourName.replaceFirstChar(Char::uppercaseChar)} extends ${CodegenTestsOnAndroidGenerator.baseTestClassName} {
|
||||
|
|
||||
""".trimMargin()
|
||||
)
|
||||
|
||||
+1
-1
@@ -28,7 +28,7 @@ object ChangeBoxingMethodTransformer : MethodTransformer() {
|
||||
val map = hashMapOf<String, String>()
|
||||
for (primitiveType in JvmPrimitiveType.values()) {
|
||||
val name = primitiveType.wrapperFqName.topLevelClassInternalName()
|
||||
map[name] = "box${primitiveType.javaKeywordName.capitalize(Locale.US)}"
|
||||
map[name] = "box${primitiveType.javaKeywordName.replaceFirstChar(Char::uppercaseChar)}"
|
||||
}
|
||||
wrapperToInternalBoxing = map
|
||||
}
|
||||
|
||||
@@ -63,9 +63,9 @@ enum class CompilerSystemProperties(val property: String) {
|
||||
}
|
||||
|
||||
val isWindows: Boolean
|
||||
get() = CompilerSystemProperties.OS_NAME.value!!.toLowerCase(Locale.ENGLISH).startsWith("windows")
|
||||
get() = CompilerSystemProperties.OS_NAME.value!!.lowercase().startsWith("windows")
|
||||
|
||||
fun String?.toBooleanLenient(): Boolean? = when (this?.toLowerCase()) {
|
||||
fun String?.toBooleanLenient(): Boolean? = when (this?.lowercase()) {
|
||||
null -> false
|
||||
in listOf("", "yes", "true", "on", "y") -> true
|
||||
in listOf("no", "false", "off", "n") -> false
|
||||
|
||||
@@ -432,7 +432,7 @@ class K2JsIrCompiler : CLICompiler<K2JSCompilerArguments>() {
|
||||
fun DceRuntimeDiagnostic.Companion.resolve(
|
||||
value: String?,
|
||||
messageCollector: MessageCollector
|
||||
): DceRuntimeDiagnostic? = when (value?.toLowerCase()) {
|
||||
): DceRuntimeDiagnostic? = when (value?.lowercase()) {
|
||||
DCE_RUNTIME_DIAGNOSTIC_LOG -> DceRuntimeDiagnostic.LOG
|
||||
DCE_RUNTIME_DIAGNOSTIC_EXCEPTION -> DceRuntimeDiagnostic.EXCEPTION
|
||||
null -> null
|
||||
|
||||
+1
-1
@@ -125,7 +125,7 @@ object CompilerOutputParser {
|
||||
// We're directly inside the root tag: <MESSAGES>
|
||||
return
|
||||
}
|
||||
val qNameLowerCase = qName.toLowerCase(Locale.US)
|
||||
val qNameLowerCase = qName.lowercase()
|
||||
var category: CompilerMessageSeverity? = CATEGORIES[qNameLowerCase]
|
||||
if (category == null) {
|
||||
messageCollector.report(ERROR, "Unknown compiler message tag: $qName")
|
||||
|
||||
@@ -107,7 +107,7 @@ private inline fun tryConnectToDaemon(port: Int, report: (DaemonReportCategory,
|
||||
private const val validFlagFileKeywordChars = "abcdefghijklmnopqrstuvwxyz0123456789-_"
|
||||
|
||||
fun makeAutodeletingFlagFile(keyword: String = "compiler-client", baseDir: File? = null): File {
|
||||
val prefix = "kotlin-${keyword.filter { validFlagFileKeywordChars.contains(it.toLowerCase()) }}-"
|
||||
val prefix = "kotlin-${keyword.filter { validFlagFileKeywordChars.contains(it.lowercaseChar()) }}-"
|
||||
val flagFile = if (baseDir?.isDirectory == true)
|
||||
Files.createTempFile(baseDir.toPath(), prefix, "-is-running").toFile()
|
||||
else
|
||||
|
||||
+1
-1
@@ -352,7 +352,7 @@ private val humanizedMemorySizeRegex = "(\\d+)([kmg]?)".toRegex()
|
||||
|
||||
private fun String.memToBytes(): Long? =
|
||||
humanizedMemorySizeRegex
|
||||
.matchEntire(this.trim().toLowerCase())
|
||||
.matchEntire(this.trim().lowercase())
|
||||
?.groups?.let { match ->
|
||||
match[1]?.value?.let {
|
||||
it.toLong() *
|
||||
|
||||
@@ -114,7 +114,7 @@ class LazyClasspathWatcher(classpath: Iterable<String>,
|
||||
}
|
||||
|
||||
|
||||
fun isClasspathFile(file: File): Boolean = file.isFile && listOf("class", "jar").contains(file.extension.toLowerCase())
|
||||
fun isClasspathFile(file: File): Boolean = file.isFile && listOf("class", "jar").contains(file.extension.lowercase())
|
||||
|
||||
fun File.md5Digest(): ByteArray {
|
||||
val md = MessageDigest.getInstance(CLASSPATH_FILE_ID_DIGEST)
|
||||
|
||||
+2
-2
@@ -160,10 +160,10 @@ class Generator(
|
||||
get() = "val $fieldName: $setType"
|
||||
|
||||
private val Alias.fieldName: String
|
||||
get() = removePrefix("Fir").decapitalize() + "s"
|
||||
get() = removePrefix("Fir").replaceFirstChar(Char::lowercaseChar) + "s"
|
||||
|
||||
private val Alias.allFieldName: String
|
||||
get() = "all${fieldName.capitalize()}"
|
||||
get() = "all${fieldName.replaceFirstChar(Char::uppercaseChar)}"
|
||||
|
||||
private val Alias.setType: String
|
||||
get() = "Set<$this>"
|
||||
|
||||
+1
-1
@@ -124,7 +124,7 @@ object ErrorListDiagnosticListRenderer : DiagnosticListRenderer() {
|
||||
get() = classifier as KClass<*>
|
||||
|
||||
private fun DiagnosticData.getFactoryFunction(): String =
|
||||
severity.name.toLowerCase() + parameters.size
|
||||
severity.name.lowercase() + parameters.size
|
||||
}
|
||||
|
||||
private inline fun <T> SmartPrinter.printSeparatedWithComma(list: List<T>, printItem: (T) -> Unit) {
|
||||
|
||||
@@ -520,7 +520,7 @@ class HtmlFirDump internal constructor(private var linkResolver: FirLinkResolver
|
||||
|
||||
private fun FlowContent.modality(modality: Modality?) {
|
||||
if (modality == null) return
|
||||
keyword(modality.name.toLowerCase())
|
||||
keyword(modality.name.lowercase())
|
||||
}
|
||||
|
||||
private fun FlowContent.visibility(visibility: Visibility) {
|
||||
|
||||
+1
-1
@@ -41,7 +41,7 @@ class Modifier(
|
||||
parameterModifiers += ParameterModifier.CONST
|
||||
return
|
||||
}
|
||||
val upperCasedModifier = modifier.toString().toUpperCase()
|
||||
val upperCasedModifier = modifier.toString().uppercase()
|
||||
when {
|
||||
INLINE_MODIFIER.contains(tokenType) -> {
|
||||
if (isInClass)
|
||||
|
||||
+2
-2
@@ -20,9 +20,9 @@ class TypeParameterModifier(
|
||||
fun addModifier(modifier: LighterASTNode) {
|
||||
val tokenType = modifier.tokenType
|
||||
when {
|
||||
VARIANCE_MODIFIER.contains(tokenType) -> this.varianceModifiers += VarianceModifier.valueOf(modifier.toString().toUpperCase())
|
||||
VARIANCE_MODIFIER.contains(tokenType) -> this.varianceModifiers += VarianceModifier.valueOf(modifier.toString().uppercase())
|
||||
REIFICATION_MODIFIER.contains(tokenType) -> this.reificationModifier =
|
||||
ReificationModifier.valueOf(modifier.toString().toUpperCase())
|
||||
ReificationModifier.valueOf(modifier.toString().uppercase())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ class TypeProjectionModifier(
|
||||
fun addModifier(modifier: LighterASTNode) {
|
||||
val tokenType = modifier.tokenType
|
||||
when {
|
||||
VARIANCE_MODIFIER.contains(tokenType) -> this.varianceModifiers += VarianceModifier.valueOf(modifier.toString().toUpperCase())
|
||||
VARIANCE_MODIFIER.contains(tokenType) -> this.varianceModifiers += VarianceModifier.valueOf(modifier.toString().uppercase())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ class TotalKotlinTest : AbstractRawFirBuilderTestCase() {
|
||||
if (file.isDirectory) continue
|
||||
/* TODO: fix this, please !!! */
|
||||
if (file.path.contains("kotlin-native") ||
|
||||
file.path.toLowerCase().contains("testdata") ||
|
||||
file.path.lowercase().contains("testdata") ||
|
||||
file.path.contains("resources")
|
||||
) continue
|
||||
if (file.extension != "kt") continue
|
||||
|
||||
+3
-3
@@ -52,7 +52,7 @@ class RawFirBuilderTotalKotlinTestCase : AbstractRawFirBuilderTestCase() {
|
||||
println("BASE PATH: $testDataPath")
|
||||
for (file in root.walkTopDown()) {
|
||||
if (file.isDirectory) continue
|
||||
val path = file.path.toLowerCase()
|
||||
val path = file.path.lowercase()
|
||||
if ("testdata" in path ||
|
||||
"kotlin-native" in path ||
|
||||
"resources" in path ||
|
||||
@@ -180,7 +180,7 @@ class RawFirBuilderTotalKotlinTestCase : AbstractRawFirBuilderTestCase() {
|
||||
val root = File(testDataPath)
|
||||
for (file in root.walkTopDown()) {
|
||||
if (file.isDirectory) continue
|
||||
val path = file.path.toLowerCase()
|
||||
val path = file.path.lowercase()
|
||||
if ("kotlin-native" in path ||
|
||||
"testdata" in path ||
|
||||
"resources" in path ||
|
||||
@@ -211,7 +211,7 @@ class RawFirBuilderTotalKotlinTestCase : AbstractRawFirBuilderTestCase() {
|
||||
var counter = 0
|
||||
for (file in root.walkTopDown()) {
|
||||
if (file.isDirectory) continue
|
||||
val path = file.path.toLowerCase()
|
||||
val path = file.path.lowercase()
|
||||
if ("kotlin-native" in path ||
|
||||
"testdata" in path ||
|
||||
"resources" in path ||
|
||||
|
||||
+1
-1
@@ -131,7 +131,7 @@ abstract class AbstractBuilderConfigurator<T : AbstractFirTreeBuilder>(val firTr
|
||||
thisRef: Nothing?,
|
||||
prop: KProperty<*>
|
||||
): ReadOnlyProperty<Nothing?, IntermediateBuilder> {
|
||||
val name = name ?: "Fir${prop.name.capitalize()}"
|
||||
val name = name ?: "Fir${prop.name.replaceFirstChar(Char::uppercaseChar)}"
|
||||
builder = IntermediateBuilder(name).apply {
|
||||
firTreeBuilder.intermediateBuilders += this
|
||||
IntermediateBuilderConfigurationContext(this).block()
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ abstract class AbstractFieldConfigurator<T : AbstractFirTreeBuilder>(private val
|
||||
|
||||
fun generateBooleanFields(vararg names: String) {
|
||||
names.forEach {
|
||||
+booleanField("is${it.capitalize()}")
|
||||
+booleanField("is${it.replaceFirstChar(Char::uppercaseChar)}")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+3
-3
@@ -27,7 +27,7 @@ fun field(name: String, typeWithArgs: Pair<Type, List<Importable>>, nullable: Bo
|
||||
}
|
||||
|
||||
fun field(type: Type, nullable: Boolean = false, withReplace: Boolean = false): Field {
|
||||
return SimpleField(type.type.decapitalize(), type.typeWithArguments, type.packageName, null, nullable, withReplace)
|
||||
return SimpleField(type.type.replaceFirstChar(Char::lowercaseChar), type.typeWithArguments, type.packageName, null, nullable, withReplace)
|
||||
}
|
||||
|
||||
fun booleanField(name: String, withReplace: Boolean = false): Field {
|
||||
@@ -57,7 +57,7 @@ fun field(name: String, element: AbstractElement, nullable: Boolean = false, wit
|
||||
}
|
||||
|
||||
fun field(element: Element, nullable: Boolean = false, withReplace: Boolean = false): Field {
|
||||
return FirField(element.name.decapitalize(), element, nullable, withReplace)
|
||||
return FirField(element.name.replaceFirstChar(Char::lowercaseChar), element, nullable, withReplace)
|
||||
}
|
||||
|
||||
// ----------- Field list -----------
|
||||
@@ -67,7 +67,7 @@ fun fieldList(name: String, type: Importable, withReplace: Boolean = false): Fie
|
||||
}
|
||||
|
||||
fun fieldList(element: Element, withReplace: Boolean = false): Field {
|
||||
return FieldList(element.name.decapitalize() + "s", element, withReplace)
|
||||
return FieldList(element.name.replaceFirstChar(Char::lowercaseChar) + "s", element, withReplace)
|
||||
}
|
||||
|
||||
// ----------- Field set -----------
|
||||
|
||||
+3
-3
@@ -228,7 +228,7 @@ fun SmartPrinter.printImplementation(implementation: Implementation) {
|
||||
|
||||
field.needsSeparateTransform -> {
|
||||
if (!(element.needTransformOtherChildren && field.needTransformInOtherChildren)) {
|
||||
println("transform${field.name.capitalize()}(transformer, data)")
|
||||
println("transform${field.name.replaceFirstChar(Char::uppercaseChar)}(transformer, data)")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ fun SmartPrinter.printImplementation(implementation: Implementation) {
|
||||
field.transform()
|
||||
}
|
||||
if (field.needTransformInOtherChildren) {
|
||||
println("transform${field.name.capitalize()}(transformer, data)")
|
||||
println("transform${field.name.replaceFirstChar(Char::uppercaseChar)}(transformer, data)")
|
||||
}
|
||||
}
|
||||
println("return this")
|
||||
@@ -335,7 +335,7 @@ fun SmartPrinter.printImplementation(implementation: Implementation) {
|
||||
}
|
||||
|
||||
for (field in allFields.filter { it.withReplace }) {
|
||||
val capitalizedFieldName = field.name.capitalize()
|
||||
val capitalizedFieldName = field.name.replaceFirstChar(Char::uppercaseChar)
|
||||
val newValue = "new$capitalizedFieldName"
|
||||
generateReplace(field, forceNullable = field.useNullableForReplace) {
|
||||
when {
|
||||
|
||||
+3
-3
@@ -96,7 +96,7 @@ val Field.isVal: Boolean get() = this is FieldList || (this is FieldWithDefault
|
||||
|
||||
|
||||
fun Field.transformFunctionDeclaration(returnType: String): String {
|
||||
return transformFunctionDeclaration(name.capitalize(), returnType)
|
||||
return transformFunctionDeclaration(name.replaceFirstChar(Char::uppercaseChar), returnType)
|
||||
}
|
||||
|
||||
fun transformFunctionDeclaration(transformName: String, returnType: String): String {
|
||||
@@ -104,7 +104,7 @@ fun transformFunctionDeclaration(transformName: String, returnType: String): Str
|
||||
}
|
||||
|
||||
fun Field.replaceFunctionDeclaration(overridenType: Importable? = null, forceNullable: Boolean = false): String {
|
||||
val capName = name.capitalize()
|
||||
val capName = name.replaceFirstChar(Char::uppercaseChar)
|
||||
val type = overridenType?.typeWithArguments ?: typeWithArguments
|
||||
|
||||
val typeWithNullable = if (forceNullable && !type.endsWith("?")) "$type?" else type
|
||||
@@ -136,7 +136,7 @@ fun Implementation.Kind?.braces(): String = when (this) {
|
||||
else -> throw IllegalStateException(this.toString())
|
||||
}
|
||||
|
||||
val Element.safeDecapitalizedName: String get() = if (name == "Class") "klass" else name.decapitalize()
|
||||
val Element.safeDecapitalizedName: String get() = if (name == "Class") "klass" else name.replaceFirstChar(Char::lowercaseChar)
|
||||
|
||||
val Importable.typeWithArguments: String
|
||||
get() = when (this) {
|
||||
|
||||
+2
-2
@@ -28,7 +28,7 @@ import java.util.*
|
||||
|
||||
object PackagePartClassUtils {
|
||||
@JvmStatic fun getPathHashCode(file: VirtualFile): Int =
|
||||
file.path.toLowerCase().hashCode()
|
||||
file.path.lowercase().hashCode()
|
||||
|
||||
private val PART_CLASS_NAME_SUFFIX = "Kt"
|
||||
|
||||
@@ -36,7 +36,7 @@ object PackagePartClassUtils {
|
||||
// NB use Locale.ENGLISH so that build is locale-independent.
|
||||
// See Javadoc on java.lang.String.toUpperCase() for more details.
|
||||
when {
|
||||
Character.isJavaIdentifierStart(str[0]) -> str.substring(0, 1).toLowerCase(Locale.ENGLISH) + str.substring(1)
|
||||
Character.isJavaIdentifierStart(str[0]) -> str.substring(0, 1).lowercase() + str.substring(1)
|
||||
str[0] == '_' -> str.substring(1)
|
||||
else -> str
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ object Renderers {
|
||||
else
|
||||
declarationWithNameAndKind
|
||||
|
||||
withPlatform.capitalize()
|
||||
withPlatform.replaceFirstChar(Char::uppercaseChar)
|
||||
}
|
||||
|
||||
|
||||
|
||||
+3
-3
@@ -51,7 +51,7 @@ abstract class KotlinSuppressCache {
|
||||
}
|
||||
|
||||
fun isSuppressed(psiElement: PsiElement, suppressionKey: String, severity: Severity) =
|
||||
isSuppressed(StringSuppressRequest(psiElement, severity, suppressionKey.toLowerCase()))
|
||||
isSuppressed(StringSuppressRequest(psiElement, severity, suppressionKey.lowercase()))
|
||||
|
||||
private fun isSuppressed(request: SuppressRequest): Boolean {
|
||||
// If diagnostics are reported in a synthetic file generated by KtPsiFactory (dummy.kt),
|
||||
@@ -158,7 +158,7 @@ abstract class KotlinSuppressCache {
|
||||
if (arrayValue is ArrayValue) {
|
||||
for (value in arrayValue.value) {
|
||||
if (value is StringValue) {
|
||||
builder.add(value.value.toLowerCase())
|
||||
builder.add(value.value.lowercase())
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -167,7 +167,7 @@ abstract class KotlinSuppressCache {
|
||||
|
||||
companion object {
|
||||
private fun getDiagnosticSuppressKey(diagnostic: Diagnostic): String =
|
||||
diagnostic.factory.name.toLowerCase()
|
||||
diagnostic.factory.name.lowercase()
|
||||
|
||||
private fun isSuppressedByStrings(key: String, strings: Set<String>, severity: Severity): Boolean =
|
||||
severity == Severity.WARNING && "warnings" in strings || key in strings
|
||||
|
||||
+2
-2
@@ -65,7 +65,7 @@ fun makeIncrementally(
|
||||
val allExtensions = kotlinExtensions + "java"
|
||||
val rootsWalk = sourceRoots.asSequence().flatMap { it.walk() }
|
||||
val files = rootsWalk.filter(File::isFile)
|
||||
val sourceFiles = files.filter { it.extension.toLowerCase() in allExtensions }.toList()
|
||||
val sourceFiles = files.filter { it.extension.lowercase() in allExtensions }.toList()
|
||||
val buildHistoryFile = File(cachesDir, "build-history.bin")
|
||||
args.javaSourceRoots = sourceRoots.map { it.absolutePath }.toTypedArray()
|
||||
val buildReporter = BuildReporter(icReporter = reporter, buildMetricsReporter = DoNothingBuildMetricsReporter)
|
||||
@@ -275,7 +275,7 @@ class IncrementalJvmCompilerRunner(
|
||||
private fun processLookupSymbolsForAndroidLayouts(changedFiles: ChangedFiles.Known): Collection<LookupSymbol> {
|
||||
val result = mutableListOf<LookupSymbol>()
|
||||
for (file in changedFiles.modified + changedFiles.removed) {
|
||||
if (file.extension.toLowerCase() != "xml") continue
|
||||
if (file.extension.lowercase() != "xml") continue
|
||||
val layoutName = file.name.substringBeforeLast('.')
|
||||
result.add(LookupSymbol(ANDROID_LAYOUT_CONTENT_LOOKUP_NAME, layoutName))
|
||||
}
|
||||
|
||||
@@ -283,7 +283,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption
|
||||
else ->
|
||||
Modality.FINAL
|
||||
}
|
||||
p(modality, defaultModality) { name.toLowerCase() }
|
||||
p(modality, defaultModality) { name.lowercase() }
|
||||
p(isExternal, "external")
|
||||
p(isFakeOverride, customModifier("fake"))
|
||||
p(isOverride, "override")
|
||||
@@ -302,7 +302,7 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption
|
||||
p(isData, "data")
|
||||
p(isCompanion, "companion")
|
||||
p(isFunInterface, "fun")
|
||||
p(classKind) { name.toLowerCase().replace('_', ' ') + if (this == ClassKind.ENUM_ENTRY) " class" else "" }
|
||||
p(classKind) { name.lowercase().replace('_', ' ') + if (this == ClassKind.ENUM_ENTRY) " class" else "" }
|
||||
p(isInfix, "infix")
|
||||
p(isOperator, "operator")
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ private fun parseLong(text: String): Long? {
|
||||
}
|
||||
|
||||
private fun parseFloatingLiteral(text: String): Number? {
|
||||
if (text.toLowerCase().endsWith('f')) {
|
||||
if (text.lowercase().endsWith('f')) {
|
||||
return parseFloat(text)
|
||||
}
|
||||
return parseDouble(text)
|
||||
|
||||
@@ -72,7 +72,7 @@ open class KotlinStubBaseImpl<T : KtElementImplStub<*>>(parent: StubElement<*>?,
|
||||
private fun getPropertyName(method: Method): String {
|
||||
val methodName = method.name!!
|
||||
if (methodName.startsWith("get")) {
|
||||
return methodName.substring(3).decapitalize()
|
||||
return methodName.substring(3).replaceFirstChar(Char::lowercaseChar)
|
||||
}
|
||||
return methodName
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ fun String.toDouble(): Double = (+(this.asDynamic())).unsafeCast<Double>().also
|
||||
TODO()
|
||||
}
|
||||
|
||||
fun String.isNaN(): Boolean = when (this.toLowerCase()) {
|
||||
fun String.isNaN(): Boolean = when (this.lowercase()) {
|
||||
"nan", "+nan", "-nan" -> true
|
||||
else -> false
|
||||
}
|
||||
|
||||
+1
-1
@@ -316,7 +316,7 @@ class ModuleStructureExtractorImpl(
|
||||
}
|
||||
|
||||
private fun parseModulePlatformByName(moduleName: String): TargetPlatform? {
|
||||
val nameSuffix = moduleName.substringAfterLast("-", "").toUpperCase()
|
||||
val nameSuffix = moduleName.substringAfterLast("-", "").uppercase()
|
||||
return when {
|
||||
nameSuffix == "COMMON" -> CommonPlatforms.defaultCommonPlatform
|
||||
nameSuffix == "JVM" -> JvmPlatforms.unspecifiedJvmPlatform // TODO(dsavvinov): determine JvmTarget precisely
|
||||
|
||||
@@ -536,7 +536,7 @@ abstract class BaseDiagnosticsTest : KotlinMultiFileTestWithJava<TestModule, Tes
|
||||
private fun parseJvmTarget(directiveMap: Directives) = directiveMap[JVM_TARGET]?.let { JvmTarget.fromString(it) }
|
||||
|
||||
protected fun parseModulePlatformByName(moduleName: String): TargetPlatform? {
|
||||
val nameSuffix = moduleName.substringAfterLast("-", "").toUpperCase()
|
||||
val nameSuffix = moduleName.substringAfterLast("-", "").uppercase()
|
||||
return when {
|
||||
nameSuffix == "COMMON" -> CommonPlatforms.defaultCommonPlatform
|
||||
nameSuffix == "JVM" -> JvmPlatforms.unspecifiedJvmPlatform // TODO(dsavvinov): determine JvmTarget precisely
|
||||
|
||||
@@ -19,14 +19,14 @@
|
||||
fun case_1(x: Class?, y: Any) {
|
||||
x?.prop_12 = if (y is String) "" else throw Exception()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String"), DEBUG_INFO_SMARTCAST!>y<!>.toUpperCase()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String"), DEBUG_INFO_SMARTCAST!>y<!>.uppercase()
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
fun case_2(x: Class?, y: Any) {
|
||||
x?.prop_9 = y is String || return
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>toUpperCase<!>()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>y<!>.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>uppercase<!>()
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -37,7 +37,7 @@ fun case_2(x: Class?, y: Any) {
|
||||
fun case_3(x: Class?, y: Any) {
|
||||
x?.prop_12 = y as String
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String"), DEBUG_INFO_SMARTCAST!>y<!>.toUpperCase()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String"), DEBUG_INFO_SMARTCAST!>y<!>.uppercase()
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -48,7 +48,7 @@ fun case_3(x: Class?, y: Any) {
|
||||
fun case_4(x: Class?, y: Any) {
|
||||
x?.prop_12 = y as? String ?: return
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String"), DEBUG_INFO_SMARTCAST!>y<!>.toUpperCase()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.String"), DEBUG_INFO_SMARTCAST!>y<!>.uppercase()
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -59,14 +59,14 @@ fun case_4(x: Class?, y: Any) {
|
||||
fun case_5(x: Class?, y: String?) {
|
||||
x?.prop_12 = y ?: return
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>y<!>.toUpperCase()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>y<!>.uppercase()
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 6
|
||||
fun case_6(x: Class?, y: String?) {
|
||||
x?.prop_9 = y !is String && throw Exception()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>y<!><!UNSAFE_CALL!>.<!>toUpperCase()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>y<!><!UNSAFE_CALL!>.<!>uppercase()
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -77,7 +77,7 @@ fun case_6(x: Class?, y: String?) {
|
||||
fun case_7(x: Class?, y: String?) {
|
||||
x?.prop_12 = y!!
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>y<!>.toUpperCase()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>y<!>.uppercase()
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -88,5 +88,5 @@ fun case_7(x: Class?, y: String?) {
|
||||
fun case_8(x: Class?, y: String?) {
|
||||
x?.prop_12 = if (y === null) throw Exception() else ""
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?")!>y<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>y<!>.toUpperCase()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String & kotlin.String?"), DEBUG_INFO_SMARTCAST!>y<!>.uppercase()
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ object TestsJsonMapGenerator {
|
||||
SECONDARY;
|
||||
|
||||
override fun toString(): String {
|
||||
return name.toLowerCase()
|
||||
return name.lowercase()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ object TestsStatisticCollector {
|
||||
val statistic = mutableMapOf<TestArea, SpecTestsStatElement>()
|
||||
|
||||
for (specTestArea in TestArea.values()) {
|
||||
val specTestsPath = "$SPEC_TESTDATA_PATH/${specTestArea.name.toLowerCase().replace("_", "/")}/${testLinkedType.testDataPath}"
|
||||
val specTestsPath = "$SPEC_TESTDATA_PATH/${specTestArea.name.lowercase().replace("_", "/")}/${testLinkedType.testDataPath}"
|
||||
|
||||
statistic[specTestArea] =
|
||||
SpecTestsStatElement(SpecTestsStatElementType.AREA)
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.regex.Pattern
|
||||
object CommonParser {
|
||||
fun String.withUnderscores() = replace(" ", "_")
|
||||
.replace(File.separator, "_")
|
||||
.toUpperCase()
|
||||
.uppercase()
|
||||
|
||||
fun String.splitByComma() = split(Regex(""",\s*"""))
|
||||
fun String.splitByPathSeparator() = split(File.separator)
|
||||
|
||||
@@ -85,8 +85,8 @@ private fun parseImplementationTestInfo(testFilePath: String, linkedTestType: Sp
|
||||
testArea = TestArea.valueOf(testInfoByContentMatcher.group("testArea").withUnderscores()),
|
||||
testType = TestType.valueOf(testInfoByContentMatcher.group("testType")),
|
||||
testNumber = testInfoElements[CommonSpecTestFileInfoElementType.NUMBER]?.content?.toInt() ?: 0,
|
||||
testDescription = fileNameWithoutExtension.toUpperCase()[0] + fileNameWithoutExtension.substring(1)
|
||||
.replace(Regex("""([A-Z])"""), " $1").toLowerCase(),
|
||||
testDescription = fileNameWithoutExtension.uppercase()[0] + fileNameWithoutExtension.substring(1)
|
||||
.replace(Regex("""([A-Z])"""), " $1").lowercase(),
|
||||
testInfoElements = testInfoElements,
|
||||
testCasesSet = SpecTestCasesSet(mutableMapOf(), mutableMapOf(), mutableMapOf()), //todo
|
||||
unexpectedBehavior = testInfoElements.contains(CommonInfoElementType.UNEXPECTED_BEHAVIOUR),
|
||||
|
||||
+1
-1
@@ -24,7 +24,7 @@ object HtmlSpecSentencesMapBuilder {
|
||||
spec.select("$SECTION_SELECTORS, $PARAGRAPH_SELECTORS, .sentence").forEach { element ->
|
||||
when {
|
||||
element.`is`(SECTION_SELECTORS) -> {
|
||||
val sectionTag = SectionTag.valueOf(element.tagName().toLowerCase())
|
||||
val sectionTag = SectionTag.valueOf(element.tagName().lowercase())
|
||||
while (!currentSectionsPath.empty() && currentSectionsPath.peek().first.level >= sectionTag.level) {
|
||||
currentSectionsPath.pop()
|
||||
}
|
||||
|
||||
+2
-2
@@ -242,7 +242,7 @@ object GenerateSteppedRangesCodegenTestData {
|
||||
|
||||
private fun PrintWriter.printTestForFunctionAndType(builder: TestBuilder, function: Function, type: Type, asLiteral: Boolean) {
|
||||
val shouldFail = (builder.expectedValuesOrFailIfNull == null)
|
||||
val listVarName = type.type.toLowerCase() + "List"
|
||||
val listVarName = type.type.lowercase() + "List"
|
||||
if (shouldFail) {
|
||||
println(" assertFailsWith<IllegalArgumentException> {")
|
||||
} else {
|
||||
@@ -253,7 +253,7 @@ object GenerateSteppedRangesCodegenTestData {
|
||||
if (asLiteral) {
|
||||
println("$indent for (i in ${builder.buildFullLiteral(type, function)}) {")
|
||||
} else {
|
||||
val progressionVarName = type.type.toLowerCase() + "Progression"
|
||||
val progressionVarName = type.type.lowercase() + "Progression"
|
||||
println("$indent val $progressionVarName = ${builder.buildRangeOnlyExpression(type, function)}")
|
||||
println("$indent for (i in ${builder.buildOnTopOfRangeOnlyVariable(progressionVarName, type)}) {")
|
||||
}
|
||||
|
||||
+4
-4
@@ -86,7 +86,7 @@ class MultiModuleJavaAnalysisCustomTest : KtUsefulTestCase() {
|
||||
val platformParameters = JvmPlatformParameters(
|
||||
packagePartProviderFactory = { PackagePartProvider.Empty },
|
||||
moduleByJavaClass = { javaClass ->
|
||||
val moduleName = javaClass.name.asString().toLowerCase().first().toString()
|
||||
val moduleName = javaClass.name.asString().lowercase().first().toString()
|
||||
modules.first { it._name == moduleName }
|
||||
},
|
||||
useBuiltinsProviderForModule = { false }
|
||||
@@ -165,8 +165,8 @@ class MultiModuleJavaAnalysisCustomTest : KtUsefulTestCase() {
|
||||
module ->
|
||||
val moduleDescriptor = resolverForProject.descriptorForModule(module)
|
||||
|
||||
checkClassInPackage(moduleDescriptor, "test", "Kotlin${module._name.toUpperCase()}")
|
||||
checkClassInPackage(moduleDescriptor, "custom", "${module._name.toUpperCase()}Class")
|
||||
checkClassInPackage(moduleDescriptor, "test", "Kotlin${module._name.uppercase()}")
|
||||
checkClassInPackage(moduleDescriptor, "custom", "${module._name.uppercase()}Class")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +229,7 @@ class MultiModuleJavaAnalysisCustomTest : KtUsefulTestCase() {
|
||||
assert(!ErrorUtils.isError(referencedDescriptor)) { "Error descriptor: $referencedDescriptor" }
|
||||
|
||||
val descriptorName = referencedDescriptor.name.asString()
|
||||
val expectedModuleName = "<${descriptorName.toLowerCase().first()}>"
|
||||
val expectedModuleName = "<${descriptorName.lowercase().first()}>"
|
||||
val moduleName = referencedDescriptor.module.name.asString()
|
||||
Assert.assertEquals(
|
||||
"Java class $descriptorName in $context should be in module $expectedModuleName, but instead was in $moduleName",
|
||||
|
||||
@@ -206,7 +206,7 @@ enum class LanguageFeature(
|
||||
|
||||
val presentableName: String
|
||||
// E.g. "DestructuringLambdaParameters" -> ["Destructuring", "Lambda", "Parameters"] -> "destructuring lambda parameters"
|
||||
get() = name.split("(?<!^)(?=[A-Z])".toRegex()).joinToString(separator = " ", transform = String::toLowerCase)
|
||||
get() = name.split("(?<!^)(?=[A-Z])".toRegex()).joinToString(separator = " ", transform = String::lowercase)
|
||||
|
||||
val presentableText get() = if (hintUrl == null) presentableName else "$presentableName (See: $hintUrl)"
|
||||
|
||||
|
||||
+1
-1
@@ -827,7 +827,7 @@ class FirVisualizer(private val firFile: FirFile) : BaseRenderer() {
|
||||
val name = arrayOfCall.typeRef.coneType.classId!!.shortClassName.asString()
|
||||
val typeArguments = arrayOfCall.typeRef.coneType.typeArguments
|
||||
val typeParameters = if (typeArguments.isEmpty()) "" else " <T>"
|
||||
data.append("fun$typeParameters ${name.decapitalize()}Of")
|
||||
data.append("fun$typeParameters ${name.replaceFirstChar(Char::lowercaseChar)}Of")
|
||||
typeArguments.firstOrNull()?.let {
|
||||
data.append("<").append(it.tryToRenderConeAsFunctionType()).append(">")
|
||||
}
|
||||
|
||||
@@ -39,10 +39,10 @@ object NameUtils {
|
||||
|
||||
@JvmStatic
|
||||
private fun capitalizeAsJavaClassName(str: String): String =
|
||||
// NB use Locale.ENGLISH so that build is locale-independent.
|
||||
// NB `uppercase` uses Locale.ROOT and is locale-independent.
|
||||
// See Javadoc on java.lang.String.toUpperCase() for more details.
|
||||
if (Character.isJavaIdentifierStart(str[0]))
|
||||
str.substring(0, 1).toUpperCase(Locale.ENGLISH) + str.substring(1)
|
||||
str.substring(0, 1).uppercase() + str.substring(1)
|
||||
else
|
||||
"_$str"
|
||||
|
||||
|
||||
+1
-1
@@ -138,7 +138,7 @@ class FunctionInvokeDescriptor private constructor(
|
||||
"E" -> "receiver"
|
||||
else -> {
|
||||
// Type parameter "P1" -> value parameter "p1", "P2" -> "p2", etc.
|
||||
typeParameterName.toLowerCase()
|
||||
typeParameterName.lowercase()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ internal class DescriptorRendererOptionsImpl : DescriptorRendererOptions {
|
||||
assert(!field.name.startsWith("is")) { "Fields named is* are not supported here yet" }
|
||||
val value = property.getValue(
|
||||
this,
|
||||
PropertyReference1Impl(DescriptorRendererOptionsImpl::class, field.name, "get" + field.name.capitalize())
|
||||
PropertyReference1Impl(DescriptorRendererOptionsImpl::class, field.name, "get" + field.name.replaceFirstChar(Char::uppercaseChar))
|
||||
)
|
||||
field.set(copy, copy.property(value))
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ fun String.decapitalizeSmartForCompiler(asciiOnly: Boolean = false): String {
|
||||
if (isEmpty() || !isUpperCaseCharAt(0, asciiOnly)) return this
|
||||
|
||||
if (length == 1 || !isUpperCaseCharAt(1, asciiOnly)) {
|
||||
return if (asciiOnly) decapitalizeAsciiOnly() else decapitalize()
|
||||
return if (asciiOnly) decapitalizeAsciiOnly() else replaceFirstChar(Char::lowercaseChar)
|
||||
}
|
||||
|
||||
val secondWordStart = (indices.firstOrNull { !isUpperCaseCharAt(it, asciiOnly) } ?: return toLowerCase(this, asciiOnly)) - 1
|
||||
@@ -98,18 +98,18 @@ private fun String.isLowerCaseCharAt(index: Int, asciiOnly: Boolean): Boolean {
|
||||
}
|
||||
|
||||
private fun toLowerCase(string: String, asciiOnly: Boolean): String {
|
||||
return if (asciiOnly) string.toLowerCaseAsciiOnly() else string.toLowerCase()
|
||||
return if (asciiOnly) string.toLowerCaseAsciiOnly() else string.lowercase()
|
||||
}
|
||||
|
||||
private fun toUpperCase(string: String, asciiOnly: Boolean): String {
|
||||
return if (asciiOnly) string.toUpperCaseAsciiOnly() else string.toUpperCase()
|
||||
return if (asciiOnly) string.toUpperCaseAsciiOnly() else string.uppercase()
|
||||
}
|
||||
|
||||
fun String.capitalizeAsciiOnly(): String {
|
||||
if (isEmpty()) return this
|
||||
val c = this[0]
|
||||
return if (c in 'a'..'z')
|
||||
c.toUpperCase() + substring(1)
|
||||
c.uppercaseChar() + substring(1)
|
||||
else
|
||||
this
|
||||
}
|
||||
@@ -118,7 +118,7 @@ fun String.decapitalizeAsciiOnly(): String {
|
||||
if (isEmpty()) return this
|
||||
val c = this[0]
|
||||
return if (c in 'A'..'Z')
|
||||
c.toLowerCase() + substring(1)
|
||||
c.lowercaseChar() + substring(1)
|
||||
else
|
||||
this
|
||||
}
|
||||
@@ -126,7 +126,7 @@ fun String.decapitalizeAsciiOnly(): String {
|
||||
fun String.toLowerCaseAsciiOnly(): String {
|
||||
val builder = StringBuilder(length)
|
||||
for (c in this) {
|
||||
builder.append(if (c in 'A'..'Z') c.toLowerCase() else c)
|
||||
builder.append(if (c in 'A'..'Z') c.lowercaseChar() else c)
|
||||
}
|
||||
return builder.toString()
|
||||
}
|
||||
@@ -134,7 +134,7 @@ fun String.toLowerCaseAsciiOnly(): String {
|
||||
fun String.toUpperCaseAsciiOnly(): String {
|
||||
val builder = StringBuilder(length)
|
||||
for (c in this) {
|
||||
builder.append(if (c in 'a'..'z') c.toUpperCase() else c)
|
||||
builder.append(if (c in 'a'..'z') c.uppercaseChar() else c)
|
||||
}
|
||||
return builder.toString()
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
+1
-1
@@ -158,7 +158,7 @@ object KDocTagCompletionProvider : CompletionProvider<CompletionParameters>() {
|
||||
val resultWithPrefix = result.withPrefixMatcher(prefix)
|
||||
KDocKnownTag.values().forEach {
|
||||
if (kdocOwner == null || it.isApplicable(kdocOwner)) {
|
||||
resultWithPrefix.addElement(LookupElementBuilder.create("@" + it.name.toLowerCase(Locale.US)))
|
||||
resultWithPrefix.addElement(LookupElementBuilder.create("@" + it.name.lowercase()))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -68,7 +68,7 @@ class VariableOrParameterNameWithTypeCompletion(
|
||||
prefixWords.indices.map { index -> if (index == 0) prefix else prefixWords.drop(index).joinToString("") }
|
||||
|
||||
userPrefixes = nameSuggestionPrefixes.indices.map { prefixWords.take(it).joinToString("") }
|
||||
classNamePrefixMatchers = nameSuggestionPrefixes.map { CamelHumpMatcher(it.capitalize(Locale.US), false) }
|
||||
classNamePrefixMatchers = nameSuggestionPrefixes.map { CamelHumpMatcher(it.replaceFirstChar(Char::uppercaseChar), false) }
|
||||
}
|
||||
|
||||
private val suggestionsByTypesAdded = HashSet<Type>()
|
||||
|
||||
+1
-1
@@ -4,4 +4,4 @@ fun foo(param: String) {
|
||||
|
||||
// EXIST: { itemText: "length", attributes: "" }
|
||||
// EXIST: { itemText: "hashCode", attributes: "" }
|
||||
// EXIST: { itemText: "capitalize", attributes: "bold" }
|
||||
// EXIST: { itemText: "lowercase", attributes: "bold" }
|
||||
|
||||
+2
-2
@@ -62,8 +62,8 @@ class ProjectConfigurationCollector : ProjectUsagesCollector() {
|
||||
val buildSystem = it.getBuildSystemType()
|
||||
return when {
|
||||
buildSystem == BuildSystemType.JPS -> "JPS"
|
||||
buildSystem.toString().toLowerCase().contains("maven") -> "Maven"
|
||||
buildSystem.toString().toLowerCase().contains("gradle") -> "Gradle"
|
||||
buildSystem.toString().lowercase().contains("maven") -> "Maven"
|
||||
buildSystem.toString().lowercase().contains("gradle") -> "Gradle"
|
||||
else -> "unknown"
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -31,7 +31,7 @@ abstract class AbstractFirLazyDeclarationResolveTest : KotlinLightCodeInsightFix
|
||||
val ktFile = myFixture.configureByText(testDataFile.name, FileUtil.loadFile(testDataFile)) as KtFile
|
||||
val lazyDeclarations = ktFile.collectDescendantsOfType<KtDeclaration> { ktDeclaration -> !KtPsiUtil.isLocal(ktDeclaration) }
|
||||
|
||||
val declarationToResolve = lazyDeclarations.firstOrNull { it.name?.toLowerCase() == "resolveme" }
|
||||
val declarationToResolve = lazyDeclarations.firstOrNull { it.name?.lowercase() == "resolveme" }
|
||||
?: error("declaration with name `resolveMe` was not found")
|
||||
resolveWithClearCaches(ktFile) { firModuleResolveState ->
|
||||
val rendered = declarationToResolve.withFirDeclaration(
|
||||
|
||||
+1
-1
@@ -100,7 +100,7 @@ private object FirToKtConversionCreator {
|
||||
if (kClass.isSubclassOf(Collection::class)) {
|
||||
val elementType = type.arguments.single().type ?: return HLIdParameterConversion
|
||||
return HLMapParameterConversion(
|
||||
parameterName = elementType.kClass.simpleName!!.decapitalize(),
|
||||
parameterName = elementType.kClass.simpleName!!.replaceFirstChar(Char::lowercaseChar),
|
||||
mappingConversion = createConversion(elementType)
|
||||
)
|
||||
}
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ class KtFirCollectionLiteralReference(
|
||||
}.associateWith { it.correspondingArrayOfCallFqName() }
|
||||
|
||||
private fun ClassId.correspondingArrayOfCallFqName(): Name =
|
||||
Name.identifier("${shortClassName.identifier.decapitalize()}Of")
|
||||
Name.identifier("${shortClassName.identifier.replaceFirstChar(Char::lowercaseChar)}Of")
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -376,7 +376,7 @@ class KotlinBuildScriptManipulator(
|
||||
findPlugin(pluginName) ?: addExpressionIfMissing("plugin(\"$pluginName\")") as? KtCallExpression
|
||||
|
||||
private fun KtFile.changeCoroutineConfiguration(coroutineOption: String): PsiElement? {
|
||||
val snippet = "experimental.coroutines = Coroutines.${coroutineOption.toUpperCase()}"
|
||||
val snippet = "experimental.coroutines = Coroutines.${coroutineOption.uppercase()}"
|
||||
val kotlinBlock = getKotlinBlock() ?: return null
|
||||
addImportIfMissing("org.jetbrains.kotlin.gradle.dsl.Coroutines")
|
||||
val statement = kotlinBlock.statements.find { it.text.startsWith("experimental.coroutines") }
|
||||
|
||||
@@ -50,7 +50,7 @@ class KotlinGradleFUSLogger : StartupActivity, DumbAware, Runnable {
|
||||
// 2. the projectId should be stable and independent on IDE version
|
||||
val presentableUrl = FileUtil.toSystemIndependentName(path)
|
||||
val name =
|
||||
PathUtilRt.getFileName(presentableUrl).toLowerCase(Locale.US).removeSuffix(ProjectFileType.DOT_DEFAULT_EXTENSION)
|
||||
PathUtilRt.getFileName(presentableUrl).lowercase().removeSuffix(ProjectFileType.DOT_DEFAULT_EXTENSION)
|
||||
val locationHash = Integer.toHexString((presentableUrl).hashCode())
|
||||
val projectHash =
|
||||
"${name.trimMiddle(name.length.coerceAtMost(254 - locationHash.length), useEllipsisSymbol = false)}.$locationHash"
|
||||
@@ -85,7 +85,7 @@ class KotlinGradleFUSLogger : StartupActivity, DumbAware, Runnable {
|
||||
val data = HashMap<String, String>()
|
||||
fun putIfNotNull(key: String, value: String?) {
|
||||
if (value != null) {
|
||||
data[key.toLowerCase()] = value
|
||||
data[key.lowercase()] = value
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -127,7 +127,7 @@ class GradleTestRunConfigurationAndHighlightingTest : GradleImportingTestCase()
|
||||
RunConfigurationsTags.SETTINGS -> settings.toString()
|
||||
}
|
||||
|
||||
result += tag.name.toLowerCase() to renderedTagValue
|
||||
result += tag.name.lowercase() to renderedTagValue
|
||||
}
|
||||
|
||||
return result.joinToString { (tagName, tagValue) -> tagName + "=\"" + tagValue.replace("\"", "\\\"") + "\"" }
|
||||
|
||||
@@ -74,7 +74,7 @@ class KotlinCompilerStartupActivity : StartupActivity {
|
||||
override fun fileGenerated(outputRoot: String, relativePath: String) {
|
||||
if (isUnitTestMode()) return
|
||||
|
||||
val ext = FileUtilRt.getExtension(relativePath).toLowerCase()
|
||||
val ext = FileUtilRt.getExtension(relativePath).lowercase()
|
||||
if (FILE_EXTS_WHICH_NEEDS_REFRESH.contains(ext)) {
|
||||
val outFile = "$outputRoot/$relativePath"
|
||||
val virtualFile = LocalFileSystem.getInstance().findFileByPath(outFile)
|
||||
|
||||
+1
-1
@@ -218,7 +218,7 @@ class ModuleNewWizardFirstStep(wizard: IdeWizard) : WizardStep(wizard, Generatio
|
||||
private fun suggestGroupId(): String {
|
||||
val username = SystemProperties.getUserName() ?: return DEFAULT_GROUP_ID
|
||||
if (!username.matches("[\\w\\s]+".toRegex())) return DEFAULT_GROUP_ID
|
||||
val usernameAsGroupId = username.trim().toLowerCase(Locale.US).split("\\s+".toRegex()).joinToString(separator = ".")
|
||||
val usernameAsGroupId = username.trim().lowercase().split("\\s+".toRegex()).joinToString(separator = ".")
|
||||
return "me.$usernameAsGroupId"
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -73,7 +73,7 @@ class ModulesEditorToolbarDecorator(
|
||||
null -> ""
|
||||
}
|
||||
|
||||
text = KotlinNewProjectWizardUIBundle.message("editor.modules.add", moduleKindTextToAdd.capitalize(Locale.US))
|
||||
text = KotlinNewProjectWizardUIBundle.message("editor.modules.add", moduleKindTextToAdd.replaceFirstChar(Char::uppercaseChar))
|
||||
}
|
||||
event.presentation.isEnabled
|
||||
}
|
||||
@@ -104,7 +104,7 @@ class ModulesEditorToolbarDecorator(
|
||||
isEnabled = tree.selectedSettingItem is Module
|
||||
text = KotlinNewProjectWizardUIBundle.message(
|
||||
"editor.modules.remove.tooltip",
|
||||
selectedModuleKindText?.let { " ${it.capitalize(Locale.US)}" }.orEmpty()
|
||||
selectedModuleKindText?.let { " ${it.replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.US) else it.toString() }}" }.orEmpty()
|
||||
)
|
||||
}
|
||||
event.presentation.isEnabled
|
||||
|
||||
@@ -16,4 +16,5 @@
|
||||
|
||||
package org.jetbrains.eval4j.test
|
||||
|
||||
fun getTestName(methodName: String) = if (methodName.startsWith("test")) methodName else "test${methodName.capitalize()}"
|
||||
fun getTestName(methodName: String) =
|
||||
if (methodName.startsWith("test")) methodName else "test${methodName.replaceFirstChar(Char::uppercaseChar)}"
|
||||
+1
-1
@@ -37,7 +37,7 @@ fun Location.isInKotlinSources(): Boolean {
|
||||
}
|
||||
|
||||
fun ReferenceType.isInKotlinSources(): Boolean {
|
||||
val fileExtension = safeSourceName()?.substringAfterLast('.')?.toLowerCase() ?: ""
|
||||
val fileExtension = safeSourceName()?.substringAfterLast('.')?.lowercase() ?: ""
|
||||
return fileExtension in KotlinFileTypeFactoryUtils.KOTLIN_EXTENSIONS || containsKotlinStrata()
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -513,7 +513,7 @@ private fun reportError(codeFragment: KtCodeFragment, position: SourcePosition?,
|
||||
)
|
||||
|
||||
LOG.error(
|
||||
"Cannot evaluate a code fragment of type " + codeFragment::class.java + ": " + message.decapitalize(),
|
||||
"Cannot evaluate a code fragment of type " + codeFragment::class.java + ": " + message.replaceFirstChar(Char::lowercaseChar),
|
||||
throwable,
|
||||
mergeAttachments(*attachments)
|
||||
)
|
||||
|
||||
+1
-1
@@ -143,7 +143,7 @@ object DebuggerUtils {
|
||||
}
|
||||
|
||||
fun isKotlinSourceFile(fileName: String): Boolean {
|
||||
val extension = FileUtilRt.getExtension(fileName).toLowerCase()
|
||||
val extension = FileUtilRt.getExtension(fileName).lowercase()
|
||||
return extension in KotlinFileTypeFactoryUtils.KOTLIN_EXTENSIONS
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -72,7 +72,7 @@ class KaptModelBuilderService : AbstractKotlinGradleModelBuilder() {
|
||||
}
|
||||
|
||||
val sourceSetName = compileTask.getSourceSetName()
|
||||
val isTest = sourceSetName.toLowerCase().endsWith("test")
|
||||
val isTest = sourceSetName.lowercase().endsWith("test")
|
||||
|
||||
val kaptGeneratedSourcesDir = getKaptDirectory("getKaptGeneratedSourcesDir", project, sourceSetName)
|
||||
val kaptGeneratedClassesDir = getKaptDirectory("getKaptGeneratedClassesDir", project, sourceSetName)
|
||||
@@ -91,7 +91,7 @@ class KaptModelBuilderService : AbstractKotlinGradleModelBuilder() {
|
||||
val compilations = target.compilations ?: continue
|
||||
for (compilation in compilations) {
|
||||
val compileTask = compilation.getCompileKotlinTaskName(project) ?: continue
|
||||
val moduleName = target.name + compilation.name.capitalize()
|
||||
val moduleName = target.name + compilation.name.replaceFirstChar(Char::uppercaseChar)
|
||||
handleCompileTask(moduleName, compileTask)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,4 +30,4 @@ fun ClassLoader.loadClassOrNull(name: String): Class<*>? {
|
||||
}
|
||||
|
||||
fun compilationFullName(simpleName: String, classifier: String?) =
|
||||
if (classifier != null) classifier + simpleName.capitalize() else simpleName
|
||||
if (classifier != null) classifier + simpleName.replaceFirstChar(Char::uppercaseChar) else simpleName
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ abstract class AbstractPerformanceCompletionHandlerTests(
|
||||
protected open val statsPrefix = "completion"
|
||||
|
||||
private fun stats(): Stats {
|
||||
val suffix = "${defaultCompletionType.toString().toLowerCase()}${if (note.isNotEmpty()) "-$note" else ""}"
|
||||
val suffix = "${defaultCompletionType.toString().lowercase()}${if (note.isNotEmpty()) "-$note" else ""}"
|
||||
return statsMap.computeIfAbsent(suffix) {
|
||||
Stats("$statsPrefix-$suffix")
|
||||
}
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ class SuspiciousCollectionReassignmentInspection : AbstractKotlinInspection() {
|
||||
else -> fixes.add(IntentionWrapper(ReplaceWithOrdinaryAssignmentIntention(), binaryExpression.containingKtFile))
|
||||
}
|
||||
|
||||
val typeText = leftDefaultType.toString().takeWhile { it != '<' }.toLowerCase()
|
||||
val typeText = leftDefaultType.toString().takeWhile { it != '<' }.lowercase()
|
||||
val operationReference = binaryExpression.operationReference
|
||||
holder.registerProblem(
|
||||
operationReference,
|
||||
|
||||
+1
-1
@@ -183,7 +183,7 @@ class ConvertFunctionTypeParameterToReceiverIntention : SelfTargetingRangeIntent
|
||||
if (callable !is PsiNamedElement) continue
|
||||
|
||||
if (!checkModifiable(callable)) {
|
||||
val renderedCallable = RefactoringUIUtil.getDescription(callable, true).capitalize()
|
||||
val renderedCallable = RefactoringUIUtil.getDescription(callable, true).replaceFirstChar(Char::uppercaseChar)
|
||||
conflicts.putValue(callable, KotlinBundle.message("can.t.modify.0", renderedCallable))
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -120,7 +120,7 @@ class ConvertFunctionTypeReceiverToParameterIntention : SelfTargetingRangeIntent
|
||||
if (callable !is KtFunction) continue
|
||||
|
||||
if (!checkModifiable(callable)) {
|
||||
val renderedCallable = RefactoringUIUtil.getDescription(callable, true).capitalize()
|
||||
val renderedCallable = RefactoringUIUtil.getDescription(callable, true).replaceFirstChar(Char::uppercaseChar)
|
||||
conflicts.putValue(callable, KotlinBundle.message("can.t.modify.0", renderedCallable))
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ class ConvertPropertyToFunctionIntention : SelfTargetingIntention<KtProperty>(
|
||||
if (callable !is PsiNamedElement) continue
|
||||
|
||||
if (!checkModifiable(callable)) {
|
||||
val renderedCallable = RefactoringUIUtil.getDescription(callable, true).capitalize()
|
||||
val renderedCallable = RefactoringUIUtil.getDescription(callable, true).replaceFirstChar(Char::uppercaseChar)
|
||||
conflicts.putValue(callable, KotlinBundle.message("can.t.modify.0", renderedCallable))
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -281,7 +281,7 @@ class MoveMemberToCompanionObjectIntention : SelfTargetingRangeIntention<KtNamed
|
||||
return
|
||||
}
|
||||
|
||||
val description = RefactoringUIUtil.getDescription(element, false).capitalize()
|
||||
val description = RefactoringUIUtil.getDescription(element, false).replaceFirstChar(Char::uppercaseChar)
|
||||
|
||||
if (HierarchySearchRequest(element, element.useScope, false).searchOverriders().any()) {
|
||||
return CommonRefactoringUtil.showErrorHint(
|
||||
|
||||
@@ -23,7 +23,7 @@ class AddArrayOfTypeFix(expression: KtExpression, expectedType: KotlinType) : Ko
|
||||
"arrayOf"
|
||||
} else {
|
||||
val typeName = DescriptorRenderer.SHORT_NAMES_IN_TYPES.renderType(expectedType)
|
||||
"${typeName.decapitalize(Locale.US)}Of"
|
||||
"${typeName.replaceFirstChar(Char::lowercaseChar)}Of"
|
||||
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -55,7 +55,7 @@ enum class ClassKind(@NonNls val keyword: String, @Nls val description: String)
|
||||
DEFAULT("", "") // Used as a placeholder and must be replaced with one of the kinds above
|
||||
}
|
||||
|
||||
fun ClassKind.toIdeaClassKind() = IdeaClassKind { this@toIdeaClassKind.description.capitalize() }
|
||||
fun ClassKind.toIdeaClassKind() = IdeaClassKind { this@toIdeaClassKind.description.replaceFirstChar(Char::uppercaseChar) }
|
||||
|
||||
val ClassKind.actionPriority: IntentionActionPriority
|
||||
get() = if (this == ANNOTATION_CLASS) IntentionActionPriority.LOW else IntentionActionPriority.NORMAL
|
||||
@@ -185,7 +185,7 @@ open class CreateClassFromUsageFix<E : KtElement> protected constructor(
|
||||
val defaultPackageFqName = file.packageFqName
|
||||
val dialog = object : CreateKotlinClassDialog(
|
||||
file.project,
|
||||
KotlinBundle.message("create.0", ideaClassKind.description.capitalize()),
|
||||
KotlinBundle.message("create.0", ideaClassKind.description.replaceFirstChar(Char::uppercaseChar)),
|
||||
className,
|
||||
defaultPackageFqName.asString(),
|
||||
ideaClassKind,
|
||||
|
||||
+1
-1
@@ -789,7 +789,7 @@ class KotlinChangeSignatureUsageProcessor : ChangeSignatureUsageProcessor {
|
||||
val prefix = if (declaration != null) RefactoringUIUtil.getDescription(declaration, true) else originalRef.text
|
||||
result.putValue(
|
||||
originalRef,
|
||||
KotlinBundle.message("text.0.will.no.longer.be.accessible.after.signature.change", prefix.capitalize())
|
||||
KotlinBundle.message("text.0.will.no.longer.be.accessible.after.signature.change", prefix.replaceFirstChar(Char::uppercaseChar))
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ abstract class AbstractKotlinInlineDialog(
|
||||
|
||||
override fun getNameLabelText(): String {
|
||||
val occurrencesString = occurrencesString?.let { " - $it" } ?: ""
|
||||
return "${kind.capitalize()} ${callable.nameAsSafeName} $occurrencesString"
|
||||
return "${kind.replaceFirstChar(Char::uppercaseChar)} ${callable.nameAsSafeName} $occurrencesString"
|
||||
}
|
||||
|
||||
private fun getInlineText(verb: String) = KotlinBundle.message(
|
||||
|
||||
+12
-11
@@ -74,21 +74,22 @@ class KotlinInplacePropertyIntroducer(
|
||||
if (availableTargets.size > 1) {
|
||||
addPanelControl(
|
||||
ControlWrapper {
|
||||
val propertyKindComboBox = with(JComboBox(availableTargets.map { it.targetName.capitalize() }.toTypedArray())) {
|
||||
addPopupMenuListener(
|
||||
object : PopupMenuListenerAdapter() {
|
||||
override fun popupMenuWillBecomeInvisible(e: PopupMenuEvent?) {
|
||||
ApplicationManager.getApplication().invokeLater {
|
||||
currentTarget = availableTargets[selectedIndex]
|
||||
val propertyKindComboBox =
|
||||
with(JComboBox(availableTargets.map { it.targetName.replaceFirstChar(Char::uppercaseChar) }.toTypedArray())) {
|
||||
addPopupMenuListener(
|
||||
object : PopupMenuListenerAdapter() {
|
||||
override fun popupMenuWillBecomeInvisible(e: PopupMenuEvent?) {
|
||||
ApplicationManager.getApplication().invokeLater {
|
||||
currentTarget = availableTargets[selectedIndex]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
selectedIndex = availableTargets.indexOf(currentTarget)
|
||||
selectedIndex = availableTargets.indexOf(currentTarget)
|
||||
|
||||
this
|
||||
}
|
||||
this
|
||||
}
|
||||
|
||||
val propertyKindLabel = JLabel(KotlinBundle.message("label.text.introduce.as"))
|
||||
propertyKindLabel.labelFor = propertyKindComboBox
|
||||
|
||||
@@ -233,7 +233,7 @@ fun reportDeclarationConflict(
|
||||
declaration: PsiElement,
|
||||
message: (renderedDeclaration: String) -> String
|
||||
) {
|
||||
conflicts.putValue(declaration, message(RefactoringUIUtil.getDescription(declaration, true).capitalize()))
|
||||
conflicts.putValue(declaration, message(RefactoringUIUtil.getDescription(declaration, true).replaceFirstChar(Char::uppercaseChar)))
|
||||
}
|
||||
|
||||
fun <T, E : PsiElement> getPsiElementPopup(
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ internal class MoveFilesWithDeclarationsViewDescriptor(
|
||||
"move.single.element.elements.header",
|
||||
UsageViewUtil.getType(myElementsToMove[0]),
|
||||
newParent.virtualFile.presentableUrl
|
||||
).capitalize()
|
||||
).replaceFirstChar(Char::uppercaseChar)
|
||||
myCodeReferencesText = KotlinBundle.message(
|
||||
"text.references.in.code.to.0.1.and.its.declarations",
|
||||
UsageViewUtil.getType(myElementsToMove[0]),
|
||||
|
||||
+5
-4
@@ -416,7 +416,7 @@ class MoveConflictChecker(
|
||||
render(container),
|
||||
render(referencedElement)
|
||||
)
|
||||
conflicts.putValue(element, message.capitalize())
|
||||
conflicts.putValue(element, message.replaceFirstChar(Char::uppercaseChar))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -494,7 +494,7 @@ class MoveConflictChecker(
|
||||
render(declaration),
|
||||
render(target)
|
||||
)
|
||||
conflicts.putValue(refExpr, message.capitalize())
|
||||
conflicts.putValue(refExpr, message.replaceFirstChar(Char::uppercaseChar))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -527,7 +527,7 @@ class MoveConflictChecker(
|
||||
render(container),
|
||||
render(memberToCheck)
|
||||
)
|
||||
conflicts.putValue(element, message.capitalize())
|
||||
conflicts.putValue(element, message.replaceFirstChar(Char::uppercaseChar))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -573,7 +573,8 @@ class MoveConflictChecker(
|
||||
val message = if (elementToMove == rootClass) {
|
||||
KotlinBundle.message("text.sealed.class.0.must.be.moved.with.all.its.subclasses", rootClass.name.toString())
|
||||
} else {
|
||||
val type = ElementDescriptionUtil.getElementDescription(elementToMove, UsageViewTypeLocation.INSTANCE).capitalize()
|
||||
val type = ElementDescriptionUtil.getElementDescription(elementToMove, UsageViewTypeLocation.INSTANCE)
|
||||
.replaceFirstChar(Char::uppercaseChar)
|
||||
KotlinBundle.message(
|
||||
"text.0.1.must.be.moved.with.sealed.parent.class.and.all.its.subclasses",
|
||||
type,
|
||||
|
||||
@@ -93,7 +93,7 @@ internal fun checkVisibilityInAbstractedMembers(
|
||||
val memberText = memberDescriptor.renderForConflicts()
|
||||
val targetText = targetDescriptor.renderForConflicts()
|
||||
val message = KotlinBundle.message("text.0.uses.1.which.will.not.be.accessible.from.subclass", memberText, targetText)
|
||||
conflicts.putValue(target, message.capitalize())
|
||||
conflicts.putValue(target, message.replaceFirstChar(Char::uppercaseChar))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -148,7 +148,7 @@ private fun KotlinPullUpData.checkClashWithSuperDeclaration(
|
||||
|
||||
if (member is KtParameter) {
|
||||
if (((targetClass as? KtClass)?.primaryConstructorParameters ?: emptyList()).any { it.name == member.name }) {
|
||||
conflicts.putValue(member, message.capitalize())
|
||||
conflicts.putValue(member, message.replaceFirstChar(Char::uppercaseChar))
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -158,7 +158,7 @@ private fun KotlinPullUpData.checkClashWithSuperDeclaration(
|
||||
val clashingSuper = getClashingMemberInTargetClass(memberDescriptor) ?: return
|
||||
if (clashingSuper.modality == Modality.ABSTRACT) return
|
||||
if (clashingSuper.kind != CallableMemberDescriptor.Kind.DECLARATION) return
|
||||
conflicts.putValue(member, message.capitalize())
|
||||
conflicts.putValue(member, message.replaceFirstChar(Char::uppercaseChar))
|
||||
}
|
||||
|
||||
private fun PsiClass.isSourceOrTarget(data: KotlinPullUpData): Boolean {
|
||||
@@ -198,7 +198,7 @@ private fun KotlinPullUpData.checkAccidentalOverrides(
|
||||
memberDescriptor.renderForConflicts(),
|
||||
it.resolveToDescriptorWrapperAware(resolutionFacade).renderForConflicts()
|
||||
)
|
||||
conflicts.putValue(clashingMember, message.capitalize())
|
||||
conflicts.putValue(clashingMember, message.replaceFirstChar(Char::uppercaseChar))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -211,7 +211,7 @@ private fun KotlinPullUpData.checkInnerClassToInterface(
|
||||
) {
|
||||
if (isInterfaceTarget && memberDescriptor is ClassDescriptor && memberDescriptor.isInner) {
|
||||
val message = KotlinBundle.message("text.inner.class.0.cannot.be.moved.to.intefrace", memberDescriptor.renderForConflicts())
|
||||
conflicts.putValue(member, message.capitalize())
|
||||
conflicts.putValue(member, message.replaceFirstChar(Char::uppercaseChar))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ private fun KotlinPullUpData.checkVisibility(
|
||||
memberDescriptor.renderForConflicts(),
|
||||
targetDescriptor.renderForConflicts()
|
||||
)
|
||||
conflicts.putValue(target, message.capitalize())
|
||||
conflicts.putValue(target, message.replaceFirstChar(Char::uppercaseChar))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,8 @@ class KotlinPushDownHandler : AbstractPullPushMembersHandler(
|
||||
|
||||
private fun reportFinalClassOrObject(project: Project, editor: Editor?, classOrObject: KtClassOrObject) {
|
||||
val message = RefactoringBundle.getCannotRefactorMessage(
|
||||
KotlinBundle.message("text.class.0.is.final", RefactoringUIUtil.getDescription(classOrObject, false)).capitalize()
|
||||
KotlinBundle.message("text.class.0.is.final", RefactoringUIUtil.getDescription(classOrObject, false))
|
||||
.replaceFirstChar(Char::uppercaseChar)
|
||||
)
|
||||
CommonRefactoringUtil.showErrorHint(project, editor, message, PULL_MEMBERS_UP, HelpID.MEMBERS_PULL_UP)
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ class KotlinPushDownProcessor(
|
||||
val usages = refUsages.get() ?: UsageInfo.EMPTY_ARRAY
|
||||
if (usages.isEmpty()) {
|
||||
val message = KotlinBundle.message("text.0.have.no.inheritors.warning", context.sourceClassDescriptor.renderForConflicts())
|
||||
val answer = Messages.showYesNoDialog(message.capitalize(), PUSH_MEMBERS_DOWN, Messages.getWarningIcon())
|
||||
val answer = Messages.showYesNoDialog(message.replaceFirstChar(Char::uppercaseChar), PUSH_MEMBERS_DOWN, Messages.getWarningIcon())
|
||||
if (answer == Messages.NO) return false
|
||||
}
|
||||
|
||||
|
||||
@@ -88,7 +88,7 @@ private fun checkConflicts(
|
||||
targetClassDescriptor.renderForConflicts(),
|
||||
context.sourceClassDescriptor.renderForConflicts()
|
||||
)
|
||||
conflicts.putValue(targetClass, message.capitalize())
|
||||
conflicts.putValue(targetClass, message.replaceFirstChar(Char::uppercaseChar))
|
||||
}
|
||||
|
||||
for (member in membersToPush) {
|
||||
@@ -146,7 +146,7 @@ private fun checkMemberClashing(
|
||||
targetClassDescriptor.renderForConflicts(),
|
||||
CommonRefactoringUtil.htmlEmphasize(member.name ?: "")
|
||||
)
|
||||
conflicts.putValue(it, message.capitalize())
|
||||
conflicts.putValue(it, message.replaceFirstChar(Char::uppercaseChar))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -217,7 +217,7 @@ private fun checkVisibility(
|
||||
targetDescriptor.renderForConflicts(),
|
||||
targetClassDescriptor.renderForConflicts()
|
||||
)
|
||||
conflicts.putValue(target, message.capitalize())
|
||||
conflicts.putValue(target, message.replaceFirstChar(Char::uppercaseChar))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ class RenameKotlinPropertyProcessor : RenameKotlinPsiProcessor() {
|
||||
result: MutableList<UsageInfo>
|
||||
) {
|
||||
fun reportAccidentalOverride(candidate: PsiNamedElement) {
|
||||
val what = UsageViewUtil.getType(declaration).capitalize()
|
||||
val what = UsageViewUtil.getType(declaration).replaceFirstChar(Char::uppercaseChar)
|
||||
val withWhat = candidate.renderDescription()
|
||||
val where = candidate.representativeContainer()?.renderDescription() ?: return
|
||||
val message = KotlinBundle.message("text.0.will.clash.with.existing.1.in.2", what, withWhat, where)
|
||||
|
||||
@@ -166,7 +166,7 @@ internal fun checkRedeclarations(
|
||||
if (overloadChecker != null && overloadChecker.isOverloadable(descriptor, candidateDescriptor)) continue
|
||||
val what = candidate.renderDescription()
|
||||
val where = candidate.representativeContainer()?.renderDescription() ?: continue
|
||||
val message = KotlinBundle.message("text.0.already.declared.in.1", what, where).capitalize()
|
||||
val message = KotlinBundle.message("text.0.already.declared.in.1", what, where).replaceFirstChar(Char::uppercaseChar)
|
||||
result += BasicUnresolvableCollisionUsageInfo(candidate, candidate, message)
|
||||
}
|
||||
}
|
||||
@@ -197,7 +197,7 @@ fun reportShadowing(
|
||||
"text.0.will.be.shadowed.by.1",
|
||||
declaration.renderDescription(),
|
||||
candidate.renderDescription()
|
||||
).capitalize()
|
||||
).replaceFirstChar(Char::uppercaseChar)
|
||||
result += BasicUnresolvableCollisionUsageInfo(refElement, elementToBindUsageInfoTo, message)
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ abstract class AbstractConfigureKotlinInTempDirTest : AbstractConfigureKotlinTes
|
||||
FileUtil.copyDir(File(projectRoot), tempDir)
|
||||
|
||||
val kotlinRuntime = File(tempDir, "lib/kotlin-stdlib.jar")
|
||||
if (getTestName(true).toLowerCase().contains("latestruntime") && kotlinRuntime.exists()) {
|
||||
if (getTestName(true).lowercase().contains("latestruntime") && kotlinRuntime.exists()) {
|
||||
ForTestCompileRuntime.runtimeJarForTests().copyTo(kotlinRuntime, overwrite = true)
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ abstract class AbstractQuickFixTest : KotlinLightCodeInsightFixtureTestCase(), Q
|
||||
}
|
||||
|
||||
override fun getProjectDescriptor(): LightProjectDescriptor =
|
||||
if ("createfromusage" in testDataPath.toLowerCase()) {
|
||||
if ("createfromusage" in testDataPath.lowercase()) {
|
||||
KotlinWithJdkAndRuntimeLightProjectDescriptor.INSTANCE
|
||||
} else {
|
||||
super.getProjectDescriptor()
|
||||
|
||||
@@ -139,7 +139,7 @@ abstract class AbstractResolveModeComparisonTest : KotlinLightCodeInsightFixture
|
||||
val modes = mark.modes
|
||||
val modesRepresentation =
|
||||
if (modes.size == RESOLVE_MODES.size) "All"
|
||||
else modes.joinToString { it.toString().toLowerCase().capitalize() }
|
||||
else modes.joinToString { it.toString().lowercase().replaceFirstChar(Char::uppercaseChar) }
|
||||
"/*$modesRepresentation (${mark.ordinal})*/"
|
||||
}
|
||||
is Mark.NotAnalyzed -> {
|
||||
|
||||
@@ -131,7 +131,7 @@ abstract class AbstractScriptConfigurationTest : KotlinCompletionTestCase() {
|
||||
}
|
||||
|
||||
// If script is inside module
|
||||
if (module != null && mainScriptFile.parentFile.name.toLowerCase().contains("module")) {
|
||||
if (module != null && mainScriptFile.parentFile.name.lowercase().contains("module")) {
|
||||
module.addDependency(
|
||||
projectLibrary(
|
||||
"script-runtime",
|
||||
|
||||
@@ -295,7 +295,7 @@ class ClassLiteralExpression(val type: Type): Expression() {
|
||||
fun createArrayInitializerExpression(arrayType: ArrayType, initializers: List<Expression>, needExplicitType: Boolean = true) : MethodCallExpression {
|
||||
val elementType = arrayType.elementType
|
||||
val createArrayFunction = when {
|
||||
elementType is PrimitiveType -> (elementType.toNotNullType().canonicalCode() + "ArrayOf").decapitalize(Locale.US)
|
||||
elementType is PrimitiveType -> (elementType.toNotNullType().canonicalCode() + "ArrayOf").replaceFirstChar(Char::lowercaseChar)
|
||||
needExplicitType -> "arrayOf<" + arrayType.elementType.canonicalCode() + ">"
|
||||
else -> "arrayOf"
|
||||
}
|
||||
|
||||
+1
-1
@@ -276,7 +276,7 @@ abstract class AbstractIncrementalJpsTest(
|
||||
}
|
||||
|
||||
if (!makeOverallResult.makeFailed) {
|
||||
if (checkDumpsCaseInsensitively && rebuildResult.mappingsDump?.toLowerCase() == makeOverallResult.mappingsDump?.toLowerCase()) {
|
||||
if (checkDumpsCaseInsensitively && rebuildResult.mappingsDump?.lowercase() == makeOverallResult.mappingsDump?.lowercase()) {
|
||||
// do nothing
|
||||
} else {
|
||||
TestCase.assertEquals(rebuildResult.mappingsDump, makeOverallResult.mappingsDump)
|
||||
|
||||
+2
-2
@@ -29,7 +29,7 @@ fun actualizeMppJpsIncTestCaseDirs(rootDir: String, dir: String) {
|
||||
}
|
||||
|
||||
class MppJpsIncTestsGenerator(val txt: ModulesTxt, val testCaseDirProvider: (TestCase) -> File) {
|
||||
val ModulesTxt.Module.capitalName get() = name.capitalize()
|
||||
val ModulesTxt.Module.capitalName get() = name.replaceFirstChar(Char::uppercaseChar)
|
||||
|
||||
val testCases: List<TestCase>
|
||||
|
||||
@@ -308,7 +308,7 @@ class MppJpsIncTestsGenerator(val txt: ModulesTxt, val testCaseDirProvider: (Tes
|
||||
protected fun serviceKtFile(module: ModulesTxt.Module, fileNameSuffix: String = ""): File {
|
||||
val suffix =
|
||||
if (module.isCommonModule) "${module.serviceName}Header"
|
||||
else "${module.name.capitalize()}${module.contentsSettings.serviceNameSuffix}Impl"
|
||||
else "${module.name.replaceFirstChar(Char::uppercaseChar)}${module.contentsSettings.serviceNameSuffix}Impl"
|
||||
|
||||
return File(dir, "${module.indexedName}_service$suffix.kt$fileNameSuffix")
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ fun Context.isObjectFunction(function: JsExpression, functionName: String): Bool
|
||||
fun Context.isKotlinFunction(function: JsExpression, name: String): Boolean {
|
||||
if (function !is JsNameRef || function.ident != name) return false
|
||||
val receiver = (function.qualifier as? JsNameRef)?.name ?: return false
|
||||
return receiver in nodes && receiver.ident.toLowerCase(Locale.US) == "kotlin"
|
||||
return receiver in nodes && receiver.ident.lowercase() == "kotlin"
|
||||
}
|
||||
|
||||
fun isSpecialFunction(expr: JsExpression, specialFunction: SpecialFunction): Boolean =
|
||||
|
||||
@@ -18,7 +18,7 @@ enum class ErrorTolerancePolicy(val allowSyntaxErrors: Boolean, val allowSemanti
|
||||
val DEFAULT = NONE
|
||||
|
||||
fun resolvePolicy(key: String): ErrorTolerancePolicy {
|
||||
return when (key.toUpperCase(Locale.US)) {
|
||||
return when (key.uppercase()) {
|
||||
"NONE" -> NONE
|
||||
"SEMANTIC" -> SEMANTIC
|
||||
"SYNTAX", "ALL" -> ALL
|
||||
|
||||
+4
-1
@@ -311,7 +311,10 @@ private class TestDataBuilder {
|
||||
.replace(KEYWORD_MARKER, keywordWithEscapeIfNeed)
|
||||
|
||||
|
||||
val fileName = "${suite.name.decapitalize()}${case.name.capitalize()}${keyword.capitalize()}.kt"
|
||||
val decapitalizedSuiteName = suite.name.replaceFirstChar(Char::lowercaseChar)
|
||||
val capitalizedCaseName = case.name.replaceFirstChar(Char::uppercaseChar)
|
||||
val capitalizedKeyword = keyword.replaceFirstChar(Char::uppercaseChar)
|
||||
val fileName = "$decapitalizedSuiteName$capitalizedCaseName$capitalizedKeyword.kt"
|
||||
|
||||
val testDataFile = File(testDataDirPath + "/" + fileName)
|
||||
|
||||
|
||||
+1
-1
@@ -109,7 +109,7 @@ object ArrayFIF : CompositeFIF() {
|
||||
}
|
||||
|
||||
private val PrimitiveType.lowerCaseName
|
||||
get() = typeName.asString().toLowerCase(Locale.US)
|
||||
get() = typeName.asString().lowercase()
|
||||
|
||||
fun getTag(descriptor: CallableDescriptor, config: JsConfig): String? {
|
||||
if (descriptor !is ConstructorDescriptor) return null
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user