Restore behavior in mapDefaultMethod for non-IR backend

Although the intention of the change 9894c216c1 (#2341) was sensible, it
unfortunately caused the type mapper to map a default method incorrectly
under certain _undiscovered_ circumstances, which leads to incorrect
bytecode being generated. Specifically, this led to an exception:

java.lang.NoSuchMethodError : org.jetbrains.kotlin.idea.debugger.evaluate.KotlinDebuggerCaches$Companion.compileCodeFragmentCacheAware$default(Lorg/jetbrains/kotlin/psi/KtCodeFragment;Lcom/intellij/debugger/SourcePosition;Lkotlin/jvm/functions/Function0;ZILjava/lang/Object;)Lkotlin/Pair;

in a developer branch where this class was refactored and moved to
another module. I was not able to determine the exact reason of this
error, so I'm workarounding it by limiting this change to the IR backend
only (where it's needed), and postponing the investigation of the
failure above for now.
This commit is contained in:
Alexander Udalov
2019-05-23 18:19:29 +02:00
parent cc26fd143e
commit 4e1effd065
@@ -911,7 +911,7 @@ class KotlinTypeMapper @JvmOverloads constructor(
val isConstructor = isConstructor(jvmSignature)
val descriptor = getDefaultDescriptor(
jvmSignature,
if (isStaticMethod(kind, functionDescriptor) || isStaticDeclaration(functionDescriptor) || isConstructor)
if (isStaticMethod(kind, functionDescriptor) || isConstructor || (isIrBackend && isStaticDeclaration(functionDescriptor)))
null else ownerType.descriptor,
functionDescriptor.unwrapFrontendVersion(),
if (isIrBackend && isConstructor) {