Don't delete nested default lambda classes during inline transformation

This commit is contained in:
Mikhael Bogdanov
2017-12-21 10:04:02 +01:00
parent b65dcf27ee
commit 50608d0844
14 changed files with 350 additions and 2 deletions
@@ -166,7 +166,7 @@ class DefaultLambda(
classReader.b,
invokeMethod.name,
invokeMethod.descriptor,
lambdaClassType)!!
lambdaClassType) ?: error("Can't find method '${invokeMethod.name}${invokeMethod.descriptor}' in '${classReader.className}'")
if (needReification) {
//nested classes could also require reification
@@ -165,7 +165,9 @@ class MethodInliner(
result.merge(transformResult)
result.addChangedType(oldClassName, newClassName)
if (inliningContext.isInliningLambda && transformationInfo!!.canRemoveAfterTransformation()) {
if (inliningContext.isInliningLambda &&
inliningContext.lambdaInfo !is DefaultLambda && //never delete default lambda classes
transformationInfo!!.canRemoveAfterTransformation()) {
// this class is transformed and original not used so we should remove original one after inlining
result.addClassToRemove(oldClassName)
}