[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:
committed by
Space Team
parent
ec167d4d42
commit
072d191306
+3
-3
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2023 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.
|
||||
*/
|
||||
|
||||
@@ -26,7 +26,7 @@ enum class PartialLinkageMode(val isEnabled: Boolean) {
|
||||
val DEFAULT = ENABLE
|
||||
|
||||
fun resolveMode(key: String): PartialLinkageMode? =
|
||||
values().firstOrNull { entry -> entry.name.equals(key, ignoreCase = true) }
|
||||
entries.firstOrNull { entry -> entry.name.equals(key, ignoreCase = true) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ enum class PartialLinkageLogLevel {
|
||||
val DEFAULT = INFO
|
||||
|
||||
fun resolveLogLevel(key: String): PartialLinkageLogLevel? =
|
||||
values().firstOrNull { entry -> entry.name.equals(key, ignoreCase = true) }
|
||||
entries.firstOrNull { entry -> entry.name.equals(key, ignoreCase = true) }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2010-2018 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.
|
||||
*/
|
||||
|
||||
@@ -89,23 +89,23 @@ private fun classFqNameEquals(symbol: IrClassSymbol, fqName: FqNameUnsafe): Bool
|
||||
}
|
||||
|
||||
private val idSignatureToPrimitiveType: Map<IdSignature.CommonSignature, PrimitiveType> =
|
||||
PrimitiveType.values().associateBy {
|
||||
PrimitiveType.entries.associateBy {
|
||||
getPublicSignature(StandardNames.BUILT_INS_PACKAGE_FQ_NAME, it.typeName.asString())
|
||||
}
|
||||
|
||||
private val shortNameToPrimitiveType: Map<Name, PrimitiveType> =
|
||||
PrimitiveType.values().associateBy(PrimitiveType::typeName)
|
||||
PrimitiveType.entries.associateBy(PrimitiveType::typeName)
|
||||
|
||||
private val idSignatureToUnsignedType: Map<IdSignature.CommonSignature, UnsignedType> =
|
||||
UnsignedType.values().associateBy {
|
||||
UnsignedType.entries.associateBy {
|
||||
getPublicSignature(StandardNames.BUILT_INS_PACKAGE_FQ_NAME, it.typeName.asString())
|
||||
}
|
||||
|
||||
private val shortNameToUnsignedType: Map<Name, UnsignedType> =
|
||||
UnsignedType.values().associateBy(UnsignedType::typeName)
|
||||
UnsignedType.entries.associateBy(UnsignedType::typeName)
|
||||
|
||||
val primitiveArrayTypesSignatures: Map<PrimitiveType, IdSignature.CommonSignature> =
|
||||
PrimitiveType.values().associateWith {
|
||||
PrimitiveType.entries.associateWith {
|
||||
getPublicSignature(StandardNames.BUILT_INS_PACKAGE_FQ_NAME, "${it.typeName.asString()}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.
|
||||
*/
|
||||
|
||||
@@ -305,7 +305,7 @@ sealed class IdSignature {
|
||||
val nameSegments: List<String> get() = declarationFqName.split('.')
|
||||
|
||||
private fun adaptMask(old: Long): Long =
|
||||
old xor Flags.values().fold(0L) { a, f ->
|
||||
old xor Flags.entries.fold(0L) { a, f ->
|
||||
if (!f.recursive) a or (old and (1L shl f.ordinal))
|
||||
else a
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user