enumValues() method that can be replaced with enumEntries() .
Use of enumEntries may improve performance of your code.
The quick-fix replaces enumValues with enumEntries.
More details: KT-61120 Provide modern and performant replacement for Enum.values()
Note: enumEntries return type is different from the one of enumValues
(EnumEntries<T> which inherits from List<T> instead of Array<T>).
Due to this in some cases quick fix inserts extra .toTypedArray() conversion to not break the code, but
for most common cases replacement will be done without it (e.g. in for loop).
Example:
enum class Version {
V1, V2
}
enumValues().values().forEach { /* .. */ }
val firstVersion = enumValues()[0]
functionExpectingArray(enumValues())
After the quick-fix is applied:
enum class Version {
V1, V2
}
enumEntries().forEach { /* .. */ }
val firstVersion = enumEntries()[0]
functionExpectingArray(enumEntries().toTypedArray() )