Do not store ClassDescriptor in EnumValue
Only store the ClassId of the enum class and the Name of the entry, and resolve the needed descriptor in getType() instead, which now takes the module instance where that descriptor should be resolved
This commit is contained in:
+4
-3
@@ -17,7 +17,8 @@
|
||||
package org.jetbrains.kotlin.android.synthetic.descriptors
|
||||
|
||||
import kotlinx.android.extensions.CacheImplementation
|
||||
import kotlinx.android.extensions.CacheImplementation.*
|
||||
import kotlinx.android.extensions.CacheImplementation.NO_CACHE
|
||||
import kotlinx.android.extensions.CacheImplementation.valueOf
|
||||
import kotlinx.android.extensions.ContainerOptions
|
||||
import org.jetbrains.kotlin.android.synthetic.codegen.AndroidContainerType
|
||||
import org.jetbrains.kotlin.descriptors.ClassDescriptor
|
||||
@@ -61,7 +62,7 @@ class ContainerOptionsProxy(val containerType: AndroidContainerType, val cache:
|
||||
}
|
||||
|
||||
private fun <E : Enum<E>> AnnotationDescriptor.getEnumValue(name: String, factory: (String) -> E): E? {
|
||||
val valueName = (allValueArguments[Name.identifier(name)] as? EnumValue)?.value?.name?.asString() ?: return null
|
||||
val valueName = (allValueArguments[Name.identifier(name)] as? EnumValue)?.enumEntryName?.asString() ?: return null
|
||||
|
||||
return try {
|
||||
factory(valueName)
|
||||
@@ -70,4 +71,4 @@ private fun <E : Enum<E>> AnnotationDescriptor.getEnumValue(name: String, factor
|
||||
// Enum.valueOf() may throw this
|
||||
null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user