JVM KT-41150: Fix backward compatibility for inline vals in inline class

In 1.3.x, for inline class member inline vals 'getFoo-impl' method was
generated in corresponding inline class.
Since 1.4.0, getters for properties returning inline class values are
mangled (so corresponding getters are named 'getFoo-<mangling_hash>'.
However, to maintain backward compatibility with libraries compiled with
1.3.x, inliner should be able to find 'getFoo-impl' method in the
bytecode.
This commit is contained in:
Dmitry Petrov
2020-08-24 11:54:59 +03:00
parent 27a22fc1e9
commit a2dabe11c5
9 changed files with 59 additions and 0 deletions
@@ -658,6 +658,10 @@ abstract class InlineCodegen<out T : BaseExpressionCodegen>(
if (nameWithoutManglingSuffix != null) {
methodNode = getMethodNode(bytes, nameWithoutManglingSuffix, asmMethod.descriptor, classType)
}
if (methodNode == null) {
val nameWithImplSuffix = "$nameWithoutManglingSuffix-impl"
methodNode = getMethodNode(bytes, nameWithImplSuffix, asmMethod.descriptor, classType)
}
}
return methodNode
}