[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,6 +1,6 @@
/*
* Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license
* that can be found in the license/LICENSE.txt file.
* 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.
*/
package org.jetbrains.kotlin.fir.lightTree.fir.modifier
@@ -125,7 +125,7 @@ open class Modifier(var modifiers: Long = ModifierFlag.NONE.value) {
override fun toString(): String {
val result = StringBuilder()
var firstAppend = true
for (value in ModifierFlag.Values) {
for (value in ModifierFlag.entries) {
if (hasFlag(value) && value != ModifierFlag.NONE) {
if (firstAppend) {
firstAppend = false
@@ -1,5 +1,5 @@
/*
* Copyright 201L0-201L9 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.
*/
@@ -49,7 +49,6 @@ enum class ModifierFlag(val value: Long) {
REIFICATION_REIFIED(1L shl 36);
companion object {
val Values = values()
val ElementTypeToModifierFlagMap: Map<IElementType, ModifierFlag> = mutableMapOf(
// Class
KtTokens.ENUM_KEYWORD to CLASS_ENUM,