Use Char extensions instead of java.lang.Character
Recipe ID
org.openrewrite.kotlin.migrate.UseKotlinChar$KtRecipeArtifact
io.moderne.recipe:recipes-kotlinReplaces JVM-only static helpers on java.lang.Character (isDigit(c), isLetter(c), toUpperCase(c), digit(c, radix), compare(a, b), toString(c), surrogate predicates) with the multiplatform Kotlin extensions on Char (c.isDigit(), c.uppercaseChar(), c.digitToInt(radix), …).
Usage
This recipe has no required configuration options. You’ll need the Moderne CLI configured before running the command below.
mod run . --recipe org.openrewrite.kotlin.migrate.UseKotlinChar$KtRecipeIf the recipe isn’t available locally, install it with:
mod config recipes jar install io.moderne.recipe:recipes-kotlin:0.2.0Definition
This recipe runs the following recipes in order.
- Use
Char.isDigit()instead ofCharacter.isDigit(c)org.openrewrite.kotlin.migrate.UseCharIsDigit$KtRecipe - Use
Char.isLetter()instead ofCharacter.isLetter(c)org.openrewrite.kotlin.migrate.UseCharIsLetter$KtRecipe - Use
Char.isLetterOrDigit()instead ofCharacter.isLetterOrDigit(c)org.openrewrite.kotlin.migrate.UseCharIsLetterOrDigit$KtRecipe - Use
Char.isWhitespace()instead ofCharacter.isWhitespace(c)org.openrewrite.kotlin.migrate.UseCharIsWhitespace$KtRecipe - Use
Char.isUpperCase()instead ofCharacter.isUpperCase(c)org.openrewrite.kotlin.migrate.UseCharIsUpperCase$KtRecipe - Use
Char.isLowerCase()instead ofCharacter.isLowerCase(c)org.openrewrite.kotlin.migrate.UseCharIsLowerCase$KtRecipe - Use
Char.isDefined()instead ofCharacter.isDefined(c)org.openrewrite.kotlin.migrate.UseCharIsDefined$KtRecipe - Use
Char.isISOControl()instead ofCharacter.isISOControl(c)org.openrewrite.kotlin.migrate.UseCharIsISOControl$KtRecipe - Use
Char.isHighSurrogate()instead ofCharacter.isHighSurrogate(c)org.openrewrite.kotlin.migrate.UseCharIsHighSurrogate$KtRecipe - Use
Char.isLowSurrogate()instead ofCharacter.isLowSurrogate(c)org.openrewrite.kotlin.migrate.UseCharIsLowSurrogate$KtRecipe - Use
Char.isTitleCase()instead ofCharacter.isTitleCase(c)org.openrewrite.kotlin.migrate.UseCharIsTitleCase$KtRecipe - Use
Char.uppercaseChar()instead ofCharacter.toUpperCase(c)org.openrewrite.kotlin.migrate.UseCharUppercaseCharForCharacter$KtRecipe - Use
Char.lowercaseChar()instead ofCharacter.toLowerCase(c)org.openrewrite.kotlin.migrate.UseCharLowercaseCharForCharacter$KtRecipe - Use
Char.digitToInt(radix)instead ofCharacter.digit(c, radix)org.openrewrite.kotlin.migrate.UseCharDigitToInt$KtRecipe - Use
Int.digitToChar(radix)instead ofCharacter.forDigit(digit, radix)org.openrewrite.kotlin.migrate.UseIntDigitToChar$KtRecipe - Use
Char.compareToinstead ofjava.lang.Character.compareorg.openrewrite.kotlin.migrate.UseCharCompareTo$KtRecipe - Use
Char.toString()instead ofCharacter.toString(c)org.openrewrite.kotlin.migrate.UseCharToString$KtRecipe
Data tables
Structured output this recipe can produce.
- Source files that had resultsSource files that were modified by the recipe run.
org.openrewrite.table.SourcesFileResults - Source files that had search resultsSearch results that were found during the recipe run.
org.openrewrite.table.SearchResults - Source files that errored on a recipeThe details of all errors produced by a recipe run.
org.openrewrite.table.SourcesFileErrors - Recipe performanceStatistics used in analyzing the performance of recipes.
org.openrewrite.table.RecipeRunStats