[kotlin-analysis] light elements for decompiled declaration should return original...
authorTagir Valeev <Tagir.Valeev@jetbrains.com>
Mon, 17 Jan 2022 05:21:37 +0000 (12:21 +0700)
committerintellij-monorepo-bot <intellij-monorepo-bot-no-reply@jetbrains.com>
Mon, 17 Jan 2022 06:56:46 +0000 (06:56 +0000)
Otherwise, com.intellij.psi.util.PsiUtil.preferCompiledElement works incorrectly
As a result, Java bytecode inference doesn't start for Kotlin-compiled classes when Kotlin plugin is available
Fixes IDEA-286315 not correct warning about NullPointerException

GitOrigin-RevId: 853cb5bd5fe12b688f859e4444fbbf06ec1dea50

plugins/kotlin/analysis/src/org/jetbrains/kotlin/idea/caches/lightClasses/decompiledDeclarations/KtLightMethodForDecompiledDeclaration.kt

index b837fbbe7c71532a22e1ddfdf4eaeb2eaa66eb9a..4162d8e2d533881b8b825bf1baebce5e5bbd4c3b 100644 (file)
@@ -100,6 +100,8 @@ class KtLightMethodForDecompiledDeclaration(
     override val clsDelegate: PsiMethod = funDelegate
 
     override fun isValid(): Boolean = parent.isValid
+
+    override fun getOriginalElement() = funDelegate
 }
 
 private fun KtLightMethod.checkIsMangled(): Boolean {