Refactor JavaEnumValueAnnotationArgument and implementations

Only require implementations to be able to compute the enum class name
and the corresponding entry name. Only this should be necessary to
correctly resolve the argument; the resolvers will find the
corresponding class descriptor if necessary
This commit is contained in:
Alexander Udalov
2017-12-29 16:21:58 +01:00
parent 907f53e539
commit 899002b681
12 changed files with 76 additions and 77 deletions
@@ -28,6 +28,7 @@ import org.jetbrains.kotlin.idea.decompiler.textBuilder.LoggingErrorReporter
import org.jetbrains.kotlin.idea.decompiler.textBuilder.ResolveEverythingToKotlinAnyLocalClassifierResolver
import org.jetbrains.kotlin.incremental.components.LookupTracker
import org.jetbrains.kotlin.load.java.structure.JavaClass
import org.jetbrains.kotlin.load.java.structure.classId
import org.jetbrains.kotlin.load.kotlin.*
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.FqName
@@ -104,7 +105,7 @@ class DirectoryBasedClassFinder(
val packageDirectory: VirtualFile,
val directoryPackageFqName: FqName
) : KotlinClassFinder {
override fun findKotlinClass(javaClass: JavaClass) = findKotlinClass(javaClass.classId)
override fun findKotlinClass(javaClass: JavaClass) = findKotlinClass(javaClass.classId!!)
override fun findKotlinClass(classId: ClassId): KotlinJvmBinaryClass? {
if (classId.packageFqName != directoryPackageFqName) {
@@ -149,10 +150,3 @@ class DirectoryBasedDataFinder(
return ClassDataWithSource(JvmProtoBufUtil.readClassDataFrom(data, strings), KotlinJvmBinarySourceElement(binaryClass))
}
}
private val JavaClass.classId: ClassId
get() {
val outer = outerClass
return if (outer == null) ClassId.topLevel(fqName!!) else outer.classId.createNestedClassId(name)
}