Ensure enum classes toString() returns kotlin.String (#16247)

When creating an enum where a valid value is `String`, the override of toString() will be the wrong type.

Simply using `*kotlin*.String` will allow using `String` as a value in an enum.
This commit is contained in:
André Roaldseth
2023-08-09 09:09:21 +02:00
committed by GitHub
parent 6a8039c672
commit 75b04bb965
2 changed files with 2 additions and 2 deletions

View File

@@ -48,7 +48,7 @@ enum class PetEnum(val value: kotlin.String) {
* This solves a problem when the variable name and its value are different, and ensures that
* the client sends the correct enum values to the server always.
*/
override fun toString(): String = value
override fun toString(): kotlin.String = value
companion object {
/**