[compiler] replace Enum values() with entries

To fix warnings. Also, use of `Enum.entries` may improve the performance

^KT-48872
This commit is contained in:
Dmitrii Gridin
2024-02-15 00:02:32 +01:00
committed by Space Team
parent ec167d4d42
commit 072d191306
60 changed files with 174 additions and 267 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2022 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -48,12 +48,12 @@ internal class ClassifierExplorer(
buildSet {
this += permittedAnnotationArrayParameterSymbols
PrimitiveType.values().forEach {
PrimitiveType.entries.forEach {
addIfNotNull(builtIns.findClass(it.typeName, BUILT_INS_PACKAGE_FQ_NAME)) // kotlin.<primitive>
addIfNotNull(builtIns.findClass(it.arrayTypeName, BUILT_INS_PACKAGE_FQ_NAME)) // kotlin.<primitive>Array
}
UnsignedType.values().forEach {
UnsignedType.entries.forEach {
addIfNotNull(builtIns.findClass(it.typeName, BUILT_INS_PACKAGE_FQ_NAME)) // kotlin.U<signed>
addIfNotNull(builtIns.findClass(it.arrayClassId.shortClassName, BUILT_INS_PACKAGE_FQ_NAME)) // kotlin.U<signed>Array
}
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -30,7 +30,7 @@ value class BinarySymbolData(val code: Long) {
val signatureId: Int get() = (code ushr 8).toInt()
val kind: SymbolKind
get() = SymbolKind.values()[symbolKindId()]
get() = SymbolKind.entries[symbolKindId()]
companion object {
fun encode(kind: SymbolKind, signatureId: Int): Long {
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2024 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
@@ -17,7 +17,7 @@ value class BinaryTypeProjection(val code: Long) {
val variance: Variance
get() {
assert(!isStarProjection)
return Variance.values()[varianceId()]
return Variance.entries[varianceId()]
}
val typeIndex: Int get() = (code ushr 2).toInt()