Change properties to methods in light class hierarchy
There's a Kotlin-Java-Kotlin hierarchy with an abstract property in a superclass and its implementation (as a get-method) in the Java subclass, which caused problems because Kotlin subclass can't have both (different symbols, same JVM signatures)
This commit is contained in:
+1
-1
@@ -48,7 +48,7 @@ public object JavaResolveExtension : CacheExtension<(PsiElement) -> Pair<JavaDes
|
||||
}
|
||||
|
||||
fun PsiMethod.getJavaMethodDescriptor(): FunctionDescriptor {
|
||||
if (this is KotlinLightMethod) throw AssertionError("Light methods are not allowed here: ${origin?.getText()}")
|
||||
if (this is KotlinLightMethod) throw AssertionError("Light methods are not allowed here: ${getOrigin()?.getText()}")
|
||||
|
||||
val resolver = JavaResolveExtension.getResolver(getProject(), this)
|
||||
val methodDescriptor = when {
|
||||
|
||||
+4
-2
@@ -24,7 +24,7 @@ import org.jetbrains.kotlin.name.FqName
|
||||
|
||||
class KotlinLightClassForDecompiledDeclaration(
|
||||
private val clsClass: ClsClassImpl,
|
||||
override val origin: JetClassOrObject?
|
||||
private val origin: JetClassOrObject?
|
||||
) : KotlinWrappingLightClass(clsClass.getManager()) {
|
||||
override fun copy() = this
|
||||
|
||||
@@ -38,5 +38,7 @@ class KotlinLightClassForDecompiledDeclaration(
|
||||
|
||||
override fun getDelegate() = clsClass
|
||||
|
||||
override val fqName: FqName = origin?.getFqName() ?: FqName(clsClass.getQualifiedName())
|
||||
override fun getOrigin() = origin
|
||||
|
||||
override fun getFqName() = origin?.getFqName() ?: FqName(clsClass.getQualifiedName())
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ private fun KotlinLightElement<*, *>.getModuleInfoForLightElement(): IdeaModuleI
|
||||
if (this is KotlinLightClassForDecompiledDeclaration) {
|
||||
return getModuleInfoByVirtualFile(getProject(), getContainingFile().getVirtualFile(), false)
|
||||
}
|
||||
val element = origin ?: when (this) {
|
||||
val element = getOrigin() ?: when (this) {
|
||||
is FakeLightClassForFileOfPackage -> this.getContainingFile()!!
|
||||
is KotlinLightClassForPackage -> this.getFiles().first()
|
||||
else -> throw IllegalStateException("Unknown light class without origin is referenced by IDE lazy resolve: $javaClass")
|
||||
|
||||
@@ -140,7 +140,7 @@ fun PsiReference.isPropertyReadOnlyUsage(): Boolean {
|
||||
|
||||
val refTarget = resolve()
|
||||
if (refTarget is KotlinLightMethod) {
|
||||
val origin = refTarget.origin
|
||||
val origin = refTarget.getOrigin()
|
||||
val declaration: JetNamedDeclaration? = when (origin) {
|
||||
is JetPropertyAccessor -> origin.getNonStrictParentOfType<JetProperty>()
|
||||
is JetProperty, is JetParameter -> origin as JetNamedDeclaration
|
||||
|
||||
Reference in New Issue
Block a user