[SLC] generate static enum methods from symbols

^KT-55496 Fixed
This commit is contained in:
Dmitrii Gridin
2022-12-15 13:29:34 +01:00
committed by Space Team
parent c28e9d5253
commit 7d0c093da7
11 changed files with 88 additions and 24 deletions
@@ -31,6 +31,7 @@ class KotlinClassInnerStuffCache(
private val myClass: KtExtensibleLightClass,
private val dependencies: List<Any>,
private val lazyCreator: LazyCreator,
private val generateEnumMethods: Boolean = true,
) {
abstract class LazyCreator {
abstract fun <T : Any> get(initializer: () -> T, dependencies: List<Any>): Lazy<T>
@@ -55,13 +56,14 @@ class KotlinClassInnerStuffCache(
private val methodsCache = cache {
val own = myClass.ownMethods
var ext = collectAugments(myClass, PsiMethod::class.java)
if (myClass.isEnum) {
if (generateEnumMethods && myClass.isEnum) {
ext = ArrayList<PsiMethod>(ext.size + 2).also {
it += ext
it.addIfNotNull(getValuesMethod())
it.addIfNotNull(getValueOfMethod())
}
}
ArrayUtil.mergeCollections(own, ext, PsiMethod.ARRAY_FACTORY)
}