FIR IDE: allow getting light class name from EDT

This commit is contained in:
Ilya Kirillov
2020-12-30 19:45:56 +01:00
parent d53af8170b
commit e63d084cdc
2 changed files with 13 additions and 1 deletions
@@ -120,7 +120,7 @@ internal abstract class FirLightClassForClassOrObjectSymbol(
abstract override fun hashCode(): Int
override fun getName(): String? = classOrObjectSymbol.name.asString()
override fun getName(): String? = allowLightClassesOnEdt { classOrObjectSymbol.name.asString() }
override fun hasModifierProperty(@NonNls name: String): Boolean = modifierList?.hasModifierProperty(name) ?: false
@@ -0,0 +1,12 @@
/*
* Copyright 2010-2020 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.idea.asJava
import org.jetbrains.kotlin.idea.frontend.api.HackToForceAllowRunningAnalyzeOnEDT
import org.jetbrains.kotlin.idea.frontend.api.hackyAllowRunningOnEdt
@OptIn(HackToForceAllowRunningAnalyzeOnEDT::class)
internal inline fun <E> allowLightClassesOnEdt(action: () -> E): E = hackyAllowRunningOnEdt(action)